Drag and Drop - Basic Movement/ collision / walking animation/ - tutorial part 1, 2, 3, 4 - GMS2

S

Sparckman

Guest
GM Version: GM:Studio
Target Platform: Desktop (should work with Mobile and HTML5)
Download: none -- see videos below

Summary:
A video tutorial series showing movement with Drag and drop coding.


o_O Hey there guys, here is part one of this DnD drag and drop basic movement tutorial.
This series will get you started making games using drag and drop. No coding.
no access required for thiz video

Sparckman :)

Here is part 2 of this tutorial. Basic movement, change direction when you move.
No coding, just drag and drop.


Here is part 3 of this tutorial, how to create basic collisions with drag and drop.

Here is part 4 of this tutorial, Walking animation when you press the arrows.
Super simple

Part 5 (Adjusting frame rate to 60 FTP and animation speed)
 
Last edited by a moderator:

Tanvaras

Member
Excellent YouTubes, have been working on my own project in GML Code, but my kids have been keen to give this a go. Your YouTubes have helped them get started in GM2 Studio with the Drop and Drag system.

Thanks
 
T

The Iron Detective

Guest
I really groove on your videos. I had a question. Is there a way to drag and drop an "idle" animation for the character. As if, when the player stops walking, and NO KEYS are pressed (away from keyboard if you will) the view changes to a breathing animation? I like that your animation stops when the character is not moving, but it would be cool to see an idle animation as if the character is still "alive" and not "frozen". Any help would be awesome. I've also posted this on your youtube channel. Any help would be great. :D
 

Specter

Member
I really groove on your videos. I had a question. Is there a way to drag and drop an "idle" animation for the character. As if, when the player stops walking, and NO KEYS are pressed (away from keyboard if you will) the view changes to a breathing animation? I like that your animation stops when the character is not moving, but it would be cool to see an idle animation as if the character is still "alive" and not "frozen". Any help would be awesome. I've also posted this on your youtube channel. Any help would be great. :D
Add the event Keyboard-no key then have it execute your idle animation.
 
B

biscuits

Guest
can you do some tutorials that aren't in text to speech?
 
B

Bubu

Guest
Add the event Keyboard-no key then have it execute your idle animation.
I rly wanted to try that too but sadly that only permanently changes the object to idle animation. I tried to use the If variable, like if the speed is 0 then change to idle, but that failed too. Any ideas how to solve this are highly appreciated <3
 
I rly wanted to try that too but sadly that only permanently changes the object to idle animation. I tried to use the If variable, like if the speed is 0 then change to idle, but that failed too. Any ideas how to solve this are highly appreciated <3
It's actually far easier than you would think.

First, remove the even Keyboard - no key. It's not needed.

I made two different sets of sprites - one with the animation for idle and another with the animation for walking; for each direction.

I have the FPS set to 60, so adjust your values to your liking

In the Player Object Create event I used the following objects:
Assign Variable object - name: animate (or similar) and set the value to 0
Assign Variable object - name: player speed (or similar) and set the value to 1.5 (or how ever fast you want your character to move)
In the events to the player object, I set the Key Down events for UP, LEFT, DOWN, and RIGHT.
In each of them, I used the following objects:
If Variable object. I used it to check the animate variable is equal to 0, if true, then
Set Sprite object - Assign the animation object to the direction for the key pressed for the non-idle animation
Assign Variable object - Assign the animate variable to 1, which will be used to skip this section in the next run (otherwise, you will never get away from the first frame in the animation sequence)​
Jump To Point object - This is connected to the Left side of the IF Variable object
If the LEFT direction, X = -playerspeed, Y = 0; both Relative checkboxes are checked
If the RIGHT direction, X = playerspeed, Y = 0; both Relative checkboxes are checked
If the UP direction, X = 0, Y = -playerspeed; both Relative checkboxes are checked
If the DOWN direction, X = 0, Y = playerspeed; both Relative checkboxes are checked
Additionally, I set the Key Up events for UP, LEFT, DOWN, and RIGHT.
In each of them, I used the following objects:
Set Sprite object - Assign it to the animation object to the direction to start the idle animation
Assign Variable object - Assign the animate variable to 0
The idea is to keep the animation moving while the button is pressed for any direction, but then will switch back to the idle animation after the key(s) are released in any given direction.

Hope this helps!
 
B

Bubu

Guest
It's actually far easier than you would think.

First, remove the even Keyboard - no key. It's not needed.

I made two different sets of sprites - one with the animation for idle and another with the animation for walking; for each direction.

I have the FPS set to 60, so adjust your values to your liking

In the Player Object Create event I used the following objects:
Assign Variable object - name: animate (or similar) and set the value to 0
Assign Variable object - name: player speed (or similar) and set the value to 1.5 (or how ever fast you want your character to move)
In the events to the player object, I set the Key Down events for UP, LEFT, DOWN, and RIGHT.
In each of them, I used the following objects:
If Variable object. I used it to check the animate variable is equal to 0, if true, then
Set Sprite object - Assign the animation object to the direction for the key pressed for the non-idle animation
Assign Variable object - Assign the animate variable to 1, which will be used to skip this section in the next run (otherwise, you will never get away from the first frame in the animation sequence)​
Jump To Point object - This is connected to the Left side of the IF Variable object
If the LEFT direction, X = -playerspeed, Y = 0; both Relative checkboxes are checked
If the RIGHT direction, X = playerspeed, Y = 0; both Relative checkboxes are checked
If the UP direction, X = 0, Y = -playerspeed; both Relative checkboxes are checked
If the DOWN direction, X = 0, Y = playerspeed; both Relative checkboxes are checked
Additionally, I set the Key Up events for UP, LEFT, DOWN, and RIGHT.
In each of them, I used the following objects:
Set Sprite object - Assign it to the animation object to the direction to start the idle animation
Assign Variable object - Assign the animate variable to 0
The idea is to keep the animation moving while the button is pressed for any direction, but then will switch back to the idle animation after the key(s) are released in any given direction.
Hope this helps!
Thank you for your reply! The way I solved the problem in the end was doing everything listed in these tutorials on my Idle animation object and then just adding Set sprite to the first place in the Key down left and Key down right tab. Then I added Key down-No key Change sprite to idle. And that worked. Hope it wont mess things up in the future of my project. I will try your suggestion! :)
 
Top