GameMaker Studio 2 Tutorial - Simple Character Movement (L, R, U, & D)

Поделиться
HTML-код
  • Опубликовано: 28 сен 2024
  • Tutorial for making a character with directional sprites move Left, Right, Up and Down.

Комментарии • 130

  • @farzananasim9452
    @farzananasim9452 3 года назад +3

    This video was extremely helpful. I watched this since I needed more understanding for my class and this was really well done, thanks!

  • @BioPhys92
    @BioPhys92 3 года назад +2

    Dude you explain this stuff really well, best tutorial I found so far, could you do one about making a basic jumping character?

  • @ajshitshed
    @ajshitshed 5 лет назад +19

    nice tutorial but why is your mouse pointer so big

  • @FossyPickles
    @FossyPickles 3 года назад +3

    Can you do a tutorial on room transistions?

  • @therahay6849
    @therahay6849 3 года назад +1

    Finally a helpful guide thank you
    But my character have an animation for when the player doesn't press anything how do I apply it?

  • @DeathDome_
    @DeathDome_ 3 месяца назад

    thank you ! but if i tap a direction quickly he doesnt take a step and still moves \slides, if i set sprite to frame 1 it breaks the animation speed. also i dont understand why "spd" is connected to set animation speed in the create event

  • @Vin1m
    @Vin1m 2 года назад

    actually really useful tutorial man thx so much

  • @benjstudios5526
    @benjstudios5526 4 года назад

    Dude, thank you so much. This helped me a lot!

  • @groovy7715
    @groovy7715 2 года назад

    thanks so much for this, it was super simple and helpful.

  • @gamermasta525
    @gamermasta525 2 года назад

    Wow you made those sprites good shit

  • @Voidicus
    @Voidicus 5 лет назад +1

    Hey Eric! I did all these steps, and yet my sprite is still going forever, and will not stop moving. What do I do?

    • @rehrocko
      @rehrocko 5 лет назад +1

      Since everyone is being mean let me explain, for each key down, you have to add a key up, that says to set the speed to 0 and anispd to 0 so keydown right keyup right.

  • @kagomeYT
    @kagomeYT 2 года назад

    how do you get the toolbox out

  • @patrickkirkby102
    @patrickkirkby102 5 лет назад

    Anyone figure out how to "wall hug" against a wall. So that we slide along while angle walking, as opposed to stopping dead if you are holding a direction against the wall?

  • @aaronpike6902
    @aaronpike6902 8 дней назад

    this saved me

  • @enderprism3336
    @enderprism3336 3 года назад

    how to get the toolbox?????????

  • @timi6134
    @timi6134 3 года назад

    tysm man!

  • @beechskullz
    @beechskullz 5 лет назад

    So I have a problem? I did everything in the video but my character seems to glitch out. So when i move left and right its all good, up and down is fine, but if I go from left or right to up and down it glitches like a few cm away from where the character was.

    • @sevynwhatley3951
      @sevynwhatley3951 4 года назад

      I'm having the exact same issue, did you ever figure it out?

    • @enashi6133
      @enashi6133 4 года назад +1

      @@sevynwhatley3951 I'm having a similar problem but mine keeps looking to the left instead of down like it's supposed and its annoying lol

  • @notfavorite
    @notfavorite 2 года назад

    tysm

  • @gottafindacoolname
    @gottafindacoolname 3 года назад

    im completely new. You say set up the sprites? how? i have a sprite sheet with all the sprites on. How do i separate them?

    • @EricGallery
      @EricGallery  3 года назад +1

      Watch this video:
      ruclips.net/video/qfZxQYxLshE/видео.html

    • @gottafindacoolname
      @gottafindacoolname 3 года назад

      @@EricGallery Thanks a lot!

  • @AmrAta69
    @AmrAta69 Год назад

    THANKSSSSS

  • @gamermasta525
    @gamermasta525 2 года назад

    One thing that irritates me actually is that you did not indicate this was drag and drop tutorial otherwise I wouldn't have watched it

  • @itzfroggi22
    @itzfroggi22 5 лет назад

    You saved my butt me dude :33

  • @sikonavideo9901
    @sikonavideo9901 5 лет назад

    Anya work for me video?

  • @firefuji3704
    @firefuji3704 6 лет назад

    what do you use to make the sprites?!?

    • @EricGallery
      @EricGallery  6 лет назад

      I just found them doing an image search on Google like "spritesheet 4x4"

    • @frickthisisdead2134
      @frickthisisdead2134 6 лет назад

      lol had a feeling u did, they look low quality and shrunk.... no offense

    • @firefuji3704
      @firefuji3704 6 лет назад +1

      i mean there pretty detailed and look pretty good tho but just pretty small like it just got smushed.

  • @Themplez
    @Themplez 2 года назад

    didnt work

  • @tiagoorevoltado2273
    @tiagoorevoltado2273 5 лет назад

    Hi guy I realy like the vídeo this realy can save my skin, BUUUTTT I realy like know if do you can teach us how the caracter can walk woth out commander. I mean same like a RPG NPC caracter. cold you teach us?

    • @hellstrays7134
      @hellstrays7134 5 лет назад

      probably from the create event you can add movement and loop it

  • @McDumDum
    @McDumDum 3 года назад

    "simple character movement"
    TWENTY FIVE MINUTES

  • @baato870
    @baato870 5 лет назад

    25 minutes?!?!?!?

  • @isml756
    @isml756 5 лет назад

    Pls gamr maker language

    • @EricGallery
      @EricGallery  5 лет назад

      My Asteroids tutorial uses Game Maker Language (ruclips.net/video/0lyLkhR0xpc/видео.html)

  • @Zentivated
    @Zentivated 5 лет назад

    Nooob, you use Drag and drop

    • @EricGallery
      @EricGallery  5 лет назад +6

      You did realize that this a tutorial for beginners brand new to GameMaker, right?
      If you want some GML go to my Asteroids tutorial
      ruclips.net/video/0lyLkhR0xpc/видео.html

    • @dre_rona
      @dre_rona 3 года назад +1

      You look like a guy who got 6 minutes into making a game, accidentally deleted your idle sprite, and quit trying to code a game

  • @WannabeComposer64
    @WannabeComposer64 5 лет назад +16

    You saved me so much time! Strait to what I need to hear!

  • @rosejuliette9180
    @rosejuliette9180 4 года назад +8

    It's really handy that you did this tutorial in drag and drop. I'm only beginning learning and whilst I have experience with C and JAVA for basic things like web design using GML to assign all of these actions gets pretty confusing. Especially since it's not immediately clear to me what I have to program in and what is handled by the platform. Seeing all these actions as separate but working together not only helps me in drag and drop but also it lets me know all of the actions I would need in GML. I get that once you have the hang of it GML is faster and more flexible... But for a beginner it is a bit of a minefield.

  • @mimivrc4148
    @mimivrc4148 2 года назад +20

    I know this is old, but to anyone finding this, I suggest you not use set direction and instead just set the "Set Speed" node to type: Horizontal for left and right and type: Vertical for up and down, make the speed negative on UP and Left, so using the variable example in the video, you type "-spd"
    this gets rid of the issue where combining key presses by pressing something like Up then Left/right at the same time can't combine while left then up/down works

    • @SulphaVODS
      @SulphaVODS 10 месяцев назад +1

      mate you are waffling

    • @ma_astro
      @ma_astro 8 месяцев назад

      thanks so much friend

    • @resistnonexist
      @resistnonexist 6 месяцев назад

      this also changes your movement from 4 direction to 8 direction (diagonal) so make sure that's what you want

    • @Mangeurdemouton
      @Mangeurdemouton 5 месяцев назад

      How would you make your character slide on a wall if I use up+right for example?

    • @ma_astro
      @ma_astro 5 месяцев назад +1

      @@Mangeurdemouton you can have the player collide with the wall. also gamemaker manual has very smooth 8 way movement that I recommend

  • @copiousgarlicbread
    @copiousgarlicbread 4 года назад +8

    sir thank you your a lifesaver, i didnt even watch the whole video and i have already gotten farther then i could have if i worked by myself with no tutorials. Thank you for this. im making an undertale-like RPG.

    • @Sean_Chaos
      @Sean_Chaos 3 года назад

      ye me too making undertale fan game
      ^v^

    • @qrard
      @qrard 7 месяцев назад

      same >

  • @codester1989
    @codester1989 3 года назад +5

    Fantastic tutorial series! Well thought out and explained - much appreciated!

  • @SeanStinksAtRoblox
    @SeanStinksAtRoblox 4 года назад +1

    I’m gonna be real here, There are way better tutorials than this most scripts start with this (Not to be rude)
    If (keyboard_check(vk_something)) or you can do “ if (keyboard_check(ord(“Letter”)))
    And under that you do this: Sprite_index = sPlayer etc
    After that: Walkspeed: something.
    And then copy all that and do the same thing. It’s way more simple than this.
    Really hope this helped inexperienced coders and game developers.
    And as he explained it in DND™ || GML is easier for inexperienced coders and game developers
    So I will write the whole code here for the create event.
    Create:
    Image_speed = 0;
    Walkspeed = 3.5; //or lower.
    Next we move on to the step (Feel free to copy and paste this)
    If (keyboard_check(ord(“D”))) {
    x += walkSpeed;
    image_speed = walkSpeed /3;
    sprite_index = ???
    }
    If (keyboard_check(ord(“A”))) {
    x -= walkSpeed;
    image_speed = walkSpeed /3;
    sprite_index = ???
    }
    If (keyboard_check(ord(“S”))) {
    y += walkSpeed;
    image_speed = walkSpeed /3;
    sprite_index = ???
    }
    If (keyboard_check(ord(“A”))) {
    y -= walkSpeed;
    image_speed = walkSpeed /3;
    sprite_index = ???
    }
    And that’s it.
    For collision just add a collision to the player object which is simple
    There will be advanced here soon for platformer lol anyways enjoy this.
    But I know this is a long as hell comment but it’s useful for most starters.
    So you don’t need to like or anything but it’s appreciated so haha please sub at least
    (This whole comment took me 38 minutes to write..)

  • @dummyslime7893
    @dummyslime7893 4 года назад +3

    Okay, so, I wanted my character to move diagonally, so I used the jump to point method, which works. However, whenever I try to walk diagonally up against a wall, my character freezes.
    I want to know if there's any way to fix this.

  • @DyzioThingsGang
    @DyzioThingsGang 5 лет назад +2

    thats a big cursor

  • @Bosun283
    @Bosun283 2 года назад +1

    Hey, is there a way to make it that when the character walks up and is facing right, he does the right walking animation, and when he is facing left, he does the left walking animation when going up, instead of making a walk up animation? And vice versa for down?

  • @Tezzica
    @Tezzica 3 месяца назад

    My sprite continues to move with 'set animation speed' at 0. Not sure where I went wrong on following this or if the functionality changed on GM
    /edit: figured it out. my sprite must have glitched on the room after deleting and replacing it on the room, it worked like a charm.

  • @eesmvglsdabest3894
    @eesmvglsdabest3894 5 лет назад +2

    What an EPIC GAMER!!!!!!

  • @bastigarratt
    @bastigarratt 6 лет назад +2

    Thanks so much for the video Eric! This helped me out a ton. Your style is also so very likeable and beginner friendly. :D

    • @EricGallery
      @EricGallery  6 лет назад +1

      Thank you, tell all of your friends.

  • @alvenath
    @alvenath Год назад

    this vid is 5 years ago but i'm having trouble with moving on the ground. for some reason my character isn't moving on the ground but it can move while hovering (i'm making a 2d platformer)

  • @Repook
    @Repook 3 года назад

    Ur so underrated have a sub thanks!!!

  • @GearedGeek
    @GearedGeek 4 года назад +1

    Can you make a video like this but include 8 way directional movement?

  • @muhammert3145
    @muhammert3145 5 месяцев назад

    what if i wanna make it to dance when i press letter on keyboard how do i make that

  • @2brosgames334
    @2brosgames334 2 года назад

    thanks dude this will make murdirous mansion come out sonner

  • @eloyherrera7650
    @eloyherrera7650 6 месяцев назад

    the toturial is incredible but what about collisions

  • @doed68
    @doed68 2 месяца назад

    so i did this but now it just walks threw the wall object

  • @FossyPickles
    @FossyPickles 3 года назад +1

    Just what I need to make my rpg

  • @BartolSzybcior
    @BartolSzybcior 2 года назад

    when i want to create event it shows me the console not the thing u have...

  • @handsomeLubna101
    @handsomeLubna101 Месяц назад

    mine wont stop moviinggg )))):

  • @SnowyFoxlinn
    @SnowyFoxlinn 2 года назад

    Nice tutorial. Using this for one of my games, HalfWay. However, I have one thing I'd like to do... Make it to where Jayde (The player) will sit. Seems easy enough. Just have to make it to where when down is pressed he'll play the sitting animation... But one issue I have is that I want him to face the direction he was already facing when standing up... Is there any way to do this?

  • @NickiMinajSTREAMPINKFRIDAY
    @NickiMinajSTREAMPINKFRIDAY 3 года назад

    how do i set the key

  • @Sean_Chaos
    @Sean_Chaos 3 года назад

    8:58 when i'm at here,
    my sprite said to me
    bye bye~

    • @EricGallery
      @EricGallery  3 года назад +1

      What do you mean by "bye bye"?

    • @Sean_Chaos
      @Sean_Chaos 3 года назад

      @@EricGallery
      The sprite is not longer on the screen

  • @graysongervais7133
    @graysongervais7133 2 года назад

    Thank you

  • @sandycolours641
    @sandycolours641 Год назад

    thanks

  • @lukediaz5291
    @lukediaz5291 4 года назад

    i love you

  • @CommanderJaffy2002
    @CommanderJaffy2002 3 года назад

    how did he get the toolbox?

    • @kagomeYT
      @kagomeYT 2 года назад

      im thinking the same thing

  • @Qumaneey22
    @Qumaneey22 2 года назад

    A

  • @Kotjek
    @Kotjek 5 лет назад +1

    but what if i wanna move up and right at the same time ... ?

    • @EricGallery
      @EricGallery  5 лет назад +3

      If you want to be able to move diagonally by pressing two keys, you will need to use the Jump to Point action. For the Left key, set the x to -4 relative, and x to 0 relative. For Right, x to 4 relative, y to 0 relative. For Up, x to 0 relative, y to -4 relative. For Down, x to 0 relative, y to 4 relative. It is kind of demonstrated in my Platform video here ruclips.net/video/ASeoKA8leU4/видео.htmlm2s

    • @Kotjek
      @Kotjek 5 лет назад +1

      @@EricGallery thank u for ur answer
      i have kinda little problem cuz im new in gamemaker
      im kinda from the tgf2 /mmf2/click team 2.5 community
      i dont know anything about this
      can u help me a little? (im looking for some tutorials on DND with RPG styles and ideas ...
      like battles movement quests chests enemys ... TEXT showing things... ya know ... :S

  • @SleepwithMusic
    @SleepwithMusic 2 года назад

    This was easy to follow. Thank you for your help. First time doing this.😊

  • @crazi_ninja8885
    @crazi_ninja8885 4 года назад

    This doesn't work fro some reason- i do have physics on though, does that interfere?

  • @MrKirby69
    @MrKirby69 2 года назад

    I love you thanks for this ima binge watch all these ༼ つ ◕_◕ ༽つ❤❤

  • @Chrinsj
    @Chrinsj 5 лет назад

    OMG! You're the best! Thank you so much! :) You saved me

  • @bobroberts8264
    @bobroberts8264 Год назад

    this has been an absolute life saver man, cannot thank you enough !!

  • @pcgaming6718
    @pcgaming6718 6 лет назад +1

    Very nice thanks!

  • @hhwea
    @hhwea 2 года назад

    When I hold down the 'right' key for example, my character moves to the right, and then if I press the 'down' key, he moves down even if I am still holding down the 'right' key. This is great, but it does not happen for all the directions. If I hold right and then hold up, the character does not go up until I let go of the right key. I can't figure out where the difference lies. How do I make it so that every key press is like the first example, so that no matter what key I'm holding in, a new direction will be activated when the associated key is pressed?

    • @vampbat
      @vampbat 2 года назад

      It sounds like 8 Directions Movement could help you. Even if you do not want to move diagonally (8), you can tell the program to move as though you only have 4, I believe. If this nice creator doesn't have a video on it yet, the creator FriendlyCosmonaut does.

  • @yarencelik3725
    @yarencelik3725 2 года назад

    thank you so much! it was great help

  • @skay3264
    @skay3264 4 года назад

    Thank YOU! :))))

  • @SqweakySqwizard
    @SqweakySqwizard 5 лет назад

    Thank you so much! This is a huge help

  • @theunlicensedspycrab5348
    @theunlicensedspycrab5348 5 лет назад

    the charachter doesn't appear for me. can you give some advice?

    • @EricGallery
      @EricGallery  5 лет назад

      Where in the video are you having the problem? Can you see the character listed under Objects in the Resources window?

    • @theunlicensedspycrab5348
      @theunlicensedspycrab5348 5 лет назад +1

      @@EricGallery in the room the background is black and the character is not showing up. yes i see it.

  • @Liamvshobos
    @Liamvshobos 5 лет назад

    When i create an event it shows no instances. Any ideas?

    • @juicyxmango
      @juicyxmango 5 лет назад

      I had the same problem, and I was able to figure out how to fix it. After you create and event, right click on the event (such as 'Create') and convert it to DnD. Once the toolbox is opened you can delete the DnD instance that appears and it wont effect the movement. I did the rest of the tutorial like this and it worked fine.

  • @beechskullz
    @beechskullz 5 лет назад

    When I move my sprite, first up and then left or right it glitches a few inches lower than it should be, how do I fix this?

    • @hellstrays7134
      @hellstrays7134 5 лет назад +2

      you need to set the axis in the same spot for all of your sprites! :)

    • @enashi6133
      @enashi6133 4 года назад

      @@hellstrays7134 Mine Jst Stays to the left when i walk even though i did everything he said. I'll try your advice! thanks

    • @enashi6133
      @enashi6133 4 года назад

      @@hellstrays7134 still does the same shit XD DARN IT

  • @rickvalk4091
    @rickvalk4091 5 лет назад

    Thanks!

  • @jfmontagne
    @jfmontagne 6 лет назад

    very useful, thank you. For the diagonal, if i have to press 2 keys (ex: up and left), do i have to code? or can i do it manually?

    • @EricGallery
      @EricGallery  6 лет назад

      If you want to be able to move diagonally by pressing two keys, you will need to use the Jump to Point action. For the Left key, set the x to -4 relative, and x to 0 relative. For Right, x to 4 relative, y to 0 relative. For Up, x to 0 relative, y to -4 relative. For Down, x to 0 relative, y to 4 relative. It is kind of demonstrated in my Platform video here ruclips.net/video/ASeoKA8leU4/видео.htmlm2s

    • @cisco2847
      @cisco2847 6 лет назад

      @@EricGallery What if I want the player to rotate to look diagnolly while moving in that direction? How do I do that?

    • @EricGallery
      @EricGallery  6 лет назад

      You would have to find a spritesheet with images at those angles. If you do a search for "spritesheet diagonal" or spritesheet 8-way" you may find something you are looking for.

  • @HiddenMatrixGaming
    @HiddenMatrixGaming 5 лет назад

    when i comes to momentum of a sprite thats moving is it better to use code for that or drag and drop

    • @EricGallery
      @EricGallery  5 лет назад

      I would normally use code, but this tutorial is for Drag and Drop.

    • @HiddenMatrixGaming
      @HiddenMatrixGaming 5 лет назад

      @@EricGallery
      i'm doing code right now and if you have any understanding of how to use it, i'm trying make my sprite move, when i press the right key and, i'm struggling figure out how to make it move, since i've made it change its instance, but it doesn't move, stays in the same play as the idle sprite instance, just wondering if you know how to get it to work, i've also put this in a step event, the only event that i have right now.
      if keyboard_check_pressed(vk_right) x -= 5;
      {
      instance_change(obj_sonicrunning1, true)
      }

    • @EricGallery
      @EricGallery  5 лет назад

      Move the moving command into the brackets like this
      if keyboard_check_pressed(vk_right)
      {
      x -= 5;
      instance_change(obj_sonicrunning1, true)
      ;
      }

    • @EricGallery
      @EricGallery  5 лет назад

      Also, it looks like you are changing objects. Just change the sprite to the left facing sprites.
      are your sprites separated by direction? If not, watch this tutorial to show how to do that: ruclips.net/video/qfZxQYxLshE/видео.html

    • @EricGallery
      @EricGallery  5 лет назад

      If they are the code would be something like sprite_index=spr_sonicrunningleft

  • @bryanedge9011
    @bryanedge9011 4 года назад

    Great tutorial! Straight and to the point! Great job!