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

Discussion in 'Tutorials' started by Sparckman, May 30, 2017.

  1. Sparckman

    Sparckman Member

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

    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: Jun 3, 2017
    J-Toon likes this.
  2. Tanvaras

    Tanvaras Member

    Jun 1, 2017
    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.

  3. anamo games

    anamo games Member

    Feb 10, 2017
    what a great tutorial !
    good job :)
  4. The Iron Detective

    The Iron Detective Member

    Jul 2, 2017
    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
  5. Specter

    Specter Member

    Jun 20, 2017
    Add the event Keyboard-no key then have it execute your idle animation.
  6. biscuits

    biscuits Member

    Jul 6, 2017
    can you do some tutorials that aren't in text to speech?
  7. Bubu

    Bubu Member

    Aug 2, 2017
    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
  8. computercoder

    computercoder Member

    Aug 13, 2017
    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!
  9. Bubu

    Bubu Member

    Aug 2, 2017
    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! :)
  10. BlackRaw

    BlackRaw Member

    Aug 16, 2017
  11. Lucas Poeiras

    Lucas Poeiras Member

    Oct 29, 2018
    I just loved this tutorial.
    Sometimes I feel like making games is easy lol

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice