I always thought coding would be boring but its really fun especially when you come across a problem and have to try to solve it then when u get it u feel so happy.
@@ocuorat2776 yo I got a problem too I don’t know how to explain since I’m new but my player can’t move neither jumping or left and right. it works when I didn’t add in the gravity but doesn’t after I added in the gravity.
@@minnnngo2053 didn't you forgot some line? i don't really know what is happening because i don't know your code ( if you could send it in here or something like i maybe might help ) another thing you can do is question this on the gamemaker reddit, it's a good place for getting help Note: english isn't my first language so maybe i wrote something wrong so i'm sorry
Hey guys, Just popping in to tell you that if you're having the issue of your sprite getting wider, then What worked for me and made it look normal was this line of code: "if (hsp != 0) image_xscale = sign(hsp) / 2.5;" I just added a /2.5 and there you go, no more wide putin. If you're having the opposite issue, I'd suggest you * 2, that way, your character will look normal, and your day won't be ruined!👌🌸
I have had so much fun with this tutorial so far. Whenever I am not working in Gamemaker I am creating art on the go. Just can't wait to have that full game. At the end of each video I am very happy with the progress, so I thank you!!
I made my own sprites with Aseprite and my charecter looks so goofy. But it's fun making my own "art". It looks like trash, but whatever, its *mine* :p Keep these tutorials coming, they are really helpfull and easy to follow.
you can use miku miku dance mmd models to sprintes I made one it was good! you can download walk motion search in niconico videos if not found try copy it and paste in niconico search " MMD 歩きモーション "
Another amazing tutorial. I really feel like you're making the best tutorials I've ever seen. So detailed and you're not rushing through. I appreciate this level of tutorial. My video tutorial anxiety doesn't overwhelm me. I know this is 6 years late, but great job, I hope you keep up the amazing work! Seeing my character move around through my own control brings a tear of accomplishment to my eye.
Thanks Shaun, loving your videos. This is a great resource. I especially enjoy that you explain what EXACTLY happens in a lot of cases (for example: the collision box automatically gets set around the non-transparent pixels). That gives me a feeling that I understand, vs just knowing how to do a specific thing.
Hi Shaun, I just wanted to say that this tutorial series in particular is exactly what I'm looking for. My ultimate goal is to tackle an RPG in the future, but I figured a platformer would be a great way to learn the fundamentals and the basics of game programming using GMS2.As you make more videos in this series I was wondering if you could cover/incorporate a couple of preferred items.1. Double jump2. Wall jump to reach higher platforms3. Permanent power ups vs. temporary power ups.4. Walk vs. Run5. Duck6. Ledge grab7. Equiping a different guns (ex. switching from a 6 shooter to a machine gun)8. Health damage and health powerups9. Animating the hero as he stands still/idle10. Intro cut scenes / Game start screenI'm sure you are already thinking about a number of these but I just wanted to mention them none the less. Cheers,
Hello, I got to say you've helped me find my motivation on game design again. I did some poor joke games with old game maker when I was 9 until I was 14 when I started to play music. I kinda kept the dream of making games in the back of my head and had few ideas I never even started because of time constraints. Now I'm 24 and I am unemployed so I finally have time to learn this stuff again and better than I ever did. Your tutorials are great reminder and teach a lot of things I couldn't do back in the day. Thank you! I will surely become a Patreon next month!
I came here from a programming background, so although I knew the logic stuff and code you were explaining, I still really appreciated the way you taught it. I have never (not even on paid causes) found something so easy to follow and understand. thank you
Twisterclone would you mind helping me with mine? im stuck on how he was able to make to 4 frames of his character running. it's my first time ever doing anything with coding and I'm just curious if I could copy his player with a link or something
I've been following along and learning more from you than any other tutorial, the way you constantly go back over things helps me remember what does what and you're a great teacher! Making a marshmellow game. Anyway, thank you! Much appreciated and lots of love
People who are having trouble with the sprite uploading, make sure your download the description assets don't click the link because it will not allow you. I hade this problem for an hour lol. Love these so useful even in 2024
If anyone is having problems cause their player sprite is colliding into walls while jumping, or it's got a weird dragging effect; Make sure your origin point is set to Middle Centre for all of your sprites (thanks T8ble) Check to see what your oPlayer object's Collision Mask is. Looks like it should be sPlayer.
for anyone who resized their character ingame and is having issue with the flipping, i used this //you could probably change the amount of times you add "sign(hsp)" // make it add itself till its equal to the amount of size its supposed to be if (hsp != 0) image_xscale = sign(hsp) + sign(hsp);
this series has already been so useful, i have been learning GML on my own now too, i could probably do all the movement again without a tutorial now, thx for this, time for guns now!
thanks for making this tutorial series! I know it has been a few years, but it helped me understand coding a platformer type game. I have been practicing with some sprites following along and it's been fun learning this. I hope to actually get to make my first real platformer sometime soon. :3
This tutorial is amazing and is essentially my introduction to coding, but I do very much wish you would cover animating asymmetrical sprites, instead of just flipping the sprite to face your ideal direction. Everything I've tried just impedes the player character's movement. It'd be very much appreciated!
A lot of people's problem here comes from the collision mask of sPlayer I think. I set it to automatic and all of my problems disappeared. Thumbs up for people to see it !
I made an idle animation for my character to bob up and down. For some reason, when he is standing on the ground, he will lift upward when the bobbing down animation starts. Any idea how to fix this?
Thank you so much for these tutorials! I started off making games from scratch in python/pygame and after my 3rd game i had enough so I came to GameMaker Studio 2 and your tutorials are helping me alot.
general tip, put this in your create event: sIdle = sPlayerIdle sRun = sPlayerRun sFall = sPlayerFall this will basicly allow you to refer to sprites as sIdle and sFall in a simpler way. and if you end up changing the name of a sprite you can change the sprite here without having to go trough and manually changing all sprites
hey, ı have a problem with movment, when my player hit the ground all animations work wery well but my player just dosn't move any more, ı can control it when ı jump it but when touch the ground it just dosn't move. Can you help me ?
@@atakancanpolat1103 `this can be caused by multiple things. number 1: collision mask. if you switch to a different sprite you also switch the collision mask, meaning that during the transition from fall to idle/walk the coll mask might get stuck in the floor. this is fixed by just having the same collision mask for all sprites or setting the standart collision mask in your player object. number 2: not checking collision properly. ive made the mistake of sometimes putting if place_meeting(x, y, oWall) instead of if place_meeting(x, y+vsp, oWall). this makes it so that it will clip into the wall hope this helps
To the people who have the problem where the character gets thinner: if (hsp < 0) image_xscale = -3; if (hsp > 0) image_xscale = 3; In my case the numbers were 3, but it may change depending on the sprite.
In case this helps anyone, my problem was similar to the top comment where it states to "Make sure your origin point is set to middle centre", but I was experiencing different behaviors than what everyone else was talking about. Behavior: Whenever I turned my character around they would "blink" forward by about the space of an entire block (32px or 64px depending on the size of your sprites) and sometimes, if there was a wall in its path, the character would get stuck in the wall. Two things seem to have fixed this. 1. Make sure ALL the sprites have their origin points set to middle centre. I believe the "blink" effect was because the origin point was set to the top left and I *think* image_xscale will, in addition to flipping the image, will flip the origin point to the top right corner. So what happens when you turn around is hsp = move * walksp is effectively (not literately) adding 32px since the origin point moved 32px. 2. From my understanding, your collision mapping should be equally padded or you'll run into issues with your character getting stuck in the wall. What do I mean by padded? if one side is 14 pixels away from the edge of the sprite box, the other side needs to be 14 too. If you have 14 pixels of empty space on the left and 15 pixels on the right, it might cause that issue.
Just started this series and I'm loving it so far... very well presented. Already reworking some of the code from the first episode to customize and tweak my game. Sub easily earned.
Instead of reading the GMS2 user manual I wish they just had a short video recording of Shaun explaining how each function / variable works in his own words. Then I could watch those videos and think, "Okay, I get it now."
If your player still get stuck into walls,try this: -Set collision mask to manual -Make sure the collision mask covers all your player's feet -Make sure that all your player sprites and their collision mask are on the same level it works for me
Make sure your sprites are a consistant size 32x32, 64x64 whatever so the "feet" in one animation dont cause it to clip below the feet in another animation, enter the falling animation, collide IN the floor, and start the loop over.
You don't have to be sorry. I am looving every second of the explanations. It ensures we know what we are doing. Also better than not giving enough detail. We aren't in a rush because Miyamoto said good games are good forever but bad games are bad forever. Or something like that. Thank you!
Hey shaun, I love your videos but I am stuck, after I made the jump animations for some reason my player is colliding half way through the wall objects, the collision mask is set to "same as sprite" on the wall objects
You have to go to sPlayerA and sPlayerR and make sure they are set to "middle-center" as well as sPlayer. My character sprite was clipping halfway through the blocks until I changed this.
My jump is odd, if I jump during my walk cycle it starts my animation with the final frame of the jump instead of the first fram. Works fine when i stand still.
If it’s getting stuck on the jump animation and you can’t move it anymore. It might be that you have the collision mask different than the other sprites. If it is it’s happening where whenever the jump hits the platform it gets stuck in the platform 👍
Thank you so much! What would I do without you! I was looking for those kinds of tutorials everywhere and it was very difficult to find any of these! Again thank you very very much!
weird stuff : when using image_xscale = sign (hsp); my character is stretched horizontally, i've not used any arbitrary number or anything what did i do wrong? could it be something happening in the sprite?
nevermind i found the problem... for those who are having the same issue : My player Object was downscaled by default to reach 64 pixels, so when applying a xscale on the sprite, it would reset the scale of x to the original 128 pixels (but not the yscale) so make sure your sprite is at the size it's supposed to be ingame
@@bubko-fw7tp if you scaled ur sprite while in room0 that is why its happening, just delete ur sprite from the room and re-add it and dont mess with the size
if you have an animation for your jumping / falling animation you should change the code to this: //Animation if(!place_meeting(x,y+1,oWall)) { image_speed = 0.5; //or speed 1 is fine too sprite_index = (putnameofanimationspritehere); if (sign(vsp) > 0) { sprite_index = (putnameofanimationspritehere); }
It does it when it jumps but as soon as it starts to fall it the animation changes how do I keep it so the animation stays until it lands on the ground ?
If Someone have Flipping sprite Issue, Image scaling Issue Do check this code replace it with existing Code of Image_xscale - "if (hsp != 0){ if (hsp > 0){ image_xscale = 3; } else image_xscale = -3; }"
Wow this was a lot of fun, I made my own sprites which was a lot of fun and helped me understand more. Your videos are really good and I'll continue with it and hopefully learn more cool stuff!
Great tutorials! Coming into this knowing code slightly, it really helps when you explain what the code does! I've made my character double jump and several other things just through your explanations!
I followed the tutorial, have all sprite collision boxes on middle center. When I walk down a ledge my character starts glitching and slowly floats down then when it hits the ground it freezes and I cant even close the program (without using task manager) Whats going wrong??? (MY CODE VVV) //Get Player Input key_left = keyboard_check(vk_left); key_right = keyboard_check(vk_right); key_jump = keyboard_check_pressed(vk_space) //Calculate Movement var move = key_right - key_left; hsp = move * walksp; //Horizontal Collision if (place_meeting (x+hsp,y,obj_wall)) { while (!place_meeting(x + sign(hsp) , y, obj_wall)) { x = 1 + sign(hsp); } hsp = 0; } x = x + hsp; vsp = vsp + grv; if (place_meeting(x,y+1,obj_wall)) && (key_jump) { vsp = -7;
} //Vertical Collision if (place_meeting (x,y+vsp,obj_wall)) { while (!place_meeting(x , y + sign(vsp), obj_wall)) { y = y + sign(vsp); } vsp = 0; } y = y + vsp; //Animation if (!place_meeting(x, y + 1, obj_wall)) { sprite_index = spr_Airborn; image_speed = 0; if (sign(vsp) > 0) image_index = 1; else image_index = 0; } else { image_speed = 1; if (hsp == 0) { sprite_index = spr_player; } else { sprite_index = spr_playerRunning; } } if (hsp != 0) image_xscale = sign(hsp);
Got it fixed for me. Open up your player's object properties and make sure you set a mask. It's located right under where you choose a sprite and parent for the object. Once I set the mask to my spr_player it worked just fine.
For anybody that had the same problem as me: everytime i tested if the code were ok, my player would always melt into the floor like its some sort of quicksand. what I did to fix it was to replace the + by a - on the first line below //Animation
@@kylecrane6281 someone suggested in another comment thread to make sure the origin of the running sprite (and airborn sprite) is set to "Middle Center." We changed origin on the original sprite in the first video but this wasn't brought up again here. If that doesn't work, maybe try changing collision mask to same as spr_player (or whatever you have named your player sprite)
In the end i made the aniation with a complete different code because it would not with the sleep mode of the player and that the glowing eye of the player at the frame 30 is still there if you turn around (i used different sprites for right and left because the glowing eye should not switch from the right to the left eye if i turn around) however i only came up with how i can do it for myself better after i watched what you did so THANK YOU 👌❤ Ps: i really like how you explain every step for beginners, even tho i don't need it because i can write C++ and there is only a small gap between those languages it is really nice and it just shows how nice you done this series keep it up 👍
Shaun, I wanted to apply a somersault animation in between the jumping and falling sprites in the code. But where in the line(s): if (!place_meeting(x,y+1,oSolid)) { sprite_index = sShinobi_Jump; image_speed = 0; if (sign(vsp) > 0) image_index = 1; else image_index = 0; } Can I do that? Can anyone help me as well? Thank you
These videos are great, a lot of tutorials show you how to code things but with yours I actually understand WHY the code works. Whether I'll remember it is another story lolol
okay Shaun, you are a great great teacher and you have my ammiration, but I am about to drop at the second episode. it has been one hour and half I am trying to figure out why after adding the running animation the character will never move sideways again (except when airborne, then you can slide on the side). I have tried to remove the part of the code involved in the running animation and doing nothing else, and it goes back to normal movement. I have tried to invert and match, the animation of running works fine if applied to the standing character. I am absolutely desperate and I am noticing a few users had the same issue. I will be a patreon supporter if you can help me!
Hey, I don't know if you still care, but I had this issue as well. I could not move left or right, except when in midair. Go back into your workspace and into your oPlayer. Mine said it was the 'same as the sprite'. Get rid of that and manually choose the corresponding player sprite. This fixed the issue for me.
I noticed an underscore is required before the "strip[number]" when naming a spritesheet. At first I tried it with a dash and it didn't recognise my sprite as a multiple
Thank you so much for doing this tutorials, its very very helpfull, also funny to see my own character doing all this stuff. For some reason while i was trying to set the jumping animation, my character could move along the room but went stucked on the "down jump" frame, so after spent a while trying to figured out what was the problem, just above the "if (!place_meeting(x,y+1,oWall))" condition i added this one ---> "if not (place_meeting(x,y+1,oWall)) sprite_index = sPlayer" and it solved my problem.
I was having the same issue. I think you missed the ! symbol, once I added it, it worked for me. So it would be: "if not (!place_meeting(x,y+1,oWall)) sprite_index = sPlayer" But thanks! You helped me, I was stuck haha
help me with xscale, when i change direction, my sprite becomes thin fixed it. i just made it like this If sign(hsp) != 0 { If sign(image_xscale) != sign(hsp) image_xscale *= -1; }
that little rant about simplifying the floor/wall checks down to a single check which is called by your further variables was something i did immediatly, for floor checks you can just use; if (place_meeting(x,y+1,oWall)) { on_floor = true } else { on_floor = false } and then every place you have (place_meeting(x,y+1,oWall)) written just replace it with (on_floor = true ) and for everytime that variable starts with an exclamation mark like so (!place_meeting(x,y+1,oWall)) simply write (on_floor = false). Can also be done for walls and ceilings super easy, so i now have 4 simple collision variables instead of checking if the player is touching the wall or not
Hello Shaun! I'm doing your tutorial for a game i'm creating with lot of friends in the Global Game Jam 2021. I was trying to download the assets from the link you put in the description, but it just close right after i click. Also congratulations for the awesome tutorial! It is fast, direct to the point and complete! :)
hey friend, i know it has a long time, but it happened to me and i fixed it. Well, u just gotta test the comand image_xscale. Set diferent numbers. in mine case, 2 and -2 handled the job. My code is this: if(hsp!=0){ image_xscale=sign(hsp)*2; }
I need help, when I start to move left of right, my animation swaps through my player and my running animation. Jumping is fine, I only have trouble with running.
I dont know how, but i had the same problem and i changed it this way... It worked for me... you should try it This is what I wrote: //Animations if (!place_meeting(x,y,oWall)) { sprite_index = sPlayer; image_speed = 1; } if (!place_meeting(x,y+1,oWall)) { sprite_index = sPlayerJumping; image_speed = 1; if (sign(vsp) > 0) image_index = 1 else image_index = 0; } //If it worked for you please like it to everyone see...
hello! nice tutorial, i learn a lot. But when i do the animations, the player just duplicate and the animation is too slow. The jump and the gravity just aren't the same as i set for them. As i say previously, the sprite duplicate, but the first sprite is the idle animation, and the second sprite is the run animation, same for the jump animation. Anyone here know how i can fix that?
For those of you who have issues with the running animation. Its essential you make sure the sprite collision doesnt extend farther downwards than the standing sprite. Also make sure the origins are all set to the same since the default is top left.
every time I jump even when I fall on the ground I continue with the frame jumping or even on the ground or jumping continues with the jumping frame someone can help me?
I love how often he says: "Okay?" to make sure that we can follow xD
The Japanese do it a lot as well.
@@devoutdesciple is your nations anthem okay okay.... okay okay .... okay okay ..... okay okay okay
@@NotJRD 20/20, 20/20 vision
FOR THOSE WHOSE PLAYERS COLLIDE INTO WALLS WHILE JUMPING:
Make sure your origin point is set to Middle Centre
T8ble LIFESAVER. THANK YOU SO MUCH
Thanks man..... it worked for me.... my player was sinking in the wall....
Thanks bro a lot
HOLY CRAP THANK YOU
i was sinking in a wall figuring out what i was doing wrong aha
The amount of details and labor is insane in these tutorials. Great source for beginners like me. Thanks a lot for the effort.
But How Do We Make Characters, If He Could Give The PNG Format Pic It Would Be Great!!
@@UMAoPLAYZ not sure if you still need it, but use something like pixel art and save it to a file, then proceed to put that image as the player
@@Z3LN0X Thanks For Your Valuable Comment, But I Have Already Finished My Project & Exported The Game Lol...
I LOVE YOU I LOVE YOU
I always thought coding would be boring but its really fun especially when you come across a problem and have to try to solve it then when u get it u feel so happy.
perfect description.
hope you've gotten far with coding after 4 years!
how good are you at coding now?
@@ts4858 he prob is better then me now.
@@M4G_123 yeah
beter than me to
Its sad to see that almost a million people saw the first video and only around 311k saw the second; people lose hope so quickly
I’ve done exactly what he did in the last video but my game doesn’t work
@@hassanjomaa5084 what's happening?
@@ocuorat2776 yo I got a problem too I don’t know how to explain since I’m new but my player can’t move neither jumping or left and right.
it works when I didn’t add in the gravity but doesn’t after I added in the gravity.
@@minnnngo2053 didn't you forgot some line? i don't really know what is happening because i don't know your code ( if you could send it in here or something like i maybe might help )
another thing you can do is question this on the gamemaker reddit, it's a good place for getting help
Note: english isn't my first language so maybe i wrote something wrong so i'm sorry
@@ocuorat2776 well you see I copied exactly what he typed but I dunno what’s wrong maybe it’s my version of gamemaker studio
These tutorials are the whole reason why I was able to make my first game!
@@Yellow_Flare I have the same question!
@@NotAMathGuy gamecrafterstudios.itch.io/en
I think everybody is just using this for their first game
@@SjbninjaChannel yo that looks awesome! Good job dude.
Same here! :D
21:50 dude THANK YOU for those tangents, they really help me understand wtf everything means.
DONT stop that.
Here in 2023 and this is still one the easiest to follow tutorials out there. Thank you!
Not going to lie, your accent makes your tutorials much easier to follow. Honestly, it makes you sound really intelligent.
lol so true
Hey guys, Just popping in to tell you that if you're having the issue of your sprite getting wider, then What worked for me and made it look normal was this line of code:
"if (hsp != 0) image_xscale = sign(hsp) / 2.5;"
I just added a /2.5 and there you go, no more wide putin.
If you're having the opposite issue, I'd suggest you * 2,
that way, your character will look normal, and your day won't be ruined!👌🌸
u are a legend
ye@@Thulipa3
Thx
mine works at /0.5😅
Thank you so much, legend.
I have had so much fun with this tutorial so far. Whenever I am not working in Gamemaker I am creating art on the go. Just can't wait to have that full game. At the end of each video I am very happy with the progress, so I thank you!!
I made my own sprites with Aseprite and my charecter looks so goofy. But it's fun making my own "art". It looks like trash, but whatever, its *mine* :p
Keep these tutorials coming, they are really helpfull and easy to follow.
The Schnensch I feel that's the most important part when creating anything. You never stop learning, so own what you make! ^-^
you can use miku miku dance mmd models
to sprintes
I made one it was good!
you can download walk motion search in niconico videos
if not found try copy it and paste in niconico search
" MMD 歩きモーション "
Bruh
It aint much but its honest work.
Mine are literally just blobs
Your Tutorial videos are as awesome as you Shaun. I was never into coding but thanks to you I am now!
Happy to help!
Another amazing tutorial. I really feel like you're making the best tutorials I've ever seen.
So detailed and you're not rushing through. I appreciate this level of tutorial. My video tutorial anxiety doesn't overwhelm me. I know this is 6 years late, but great job, I hope you keep up the amazing work!
Seeing my character move around through my own control brings a tear of accomplishment to my eye.
how did u download his assets?
@@flolko4412 Oh, I didn’t. I’m just following along with my own test sprites and making boxes the same way they are in the video.
@@flolko4412 If you use Edge it will let you download the assets.
Thanks Shaun, loving your videos. This is a great resource.
I especially enjoy that you explain what EXACTLY happens in a lot of cases (for example: the collision box automatically gets set around the non-transparent pixels). That gives me a feeling that I understand, vs just knowing how to do a specific thing.
Hi Shaun, I just wanted to say that this tutorial series in particular is exactly what I'm looking for. My ultimate goal is to tackle an RPG in the future, but I figured a platformer would be a great way to learn the fundamentals and the basics of game programming using GMS2.As you make more videos in this series I was wondering if you could cover/incorporate a couple of preferred items.1. Double jump2. Wall jump to reach higher platforms3. Permanent power ups vs. temporary power ups.4. Walk vs. Run5. Duck6. Ledge grab7. Equiping a different guns (ex. switching from a 6 shooter to a machine gun)8. Health damage and health powerups9. Animating the hero as he stands still/idle10. Intro cut scenes / Game start screenI'm sure you are already thinking about a number of these but I just wanted to mention them none the less. Cheers,
Hello, I got to say you've helped me find my motivation on game design again. I did some poor joke games with old game maker when I was 9 until I was 14 when I started to play music. I kinda kept the dream of making games in the back of my head and had few ideas I never even started because of time constraints. Now I'm 24 and I am unemployed so I finally have time to learn this stuff again and better than I ever did. Your tutorials are great reminder and teach a lot of things I couldn't do back in the day.
Thank you! I will surely become a Patreon next month!
I came here from a programming background, so although I knew the logic stuff and code you were explaining, I still really appreciated the way you taught it. I have never (not even on paid causes) found something so easy to follow and understand. thank you
Twisterclone would you mind helping me with mine? im stuck on how he was able to make to 4 frames of his character running. it's my first time ever doing anything with coding and I'm just curious if I could copy his player with a link or something
I've been following along and learning more from you than any other tutorial, the way you constantly go back over things helps me remember what does what and you're a great teacher! Making a marshmellow game. Anyway, thank you! Much appreciated and lots of love
People who are having trouble with the sprite uploading, make sure your download the description assets don't click the link because it will not allow you.
I hade this problem for an hour lol.
Love these so useful even in 2024
Your first tutorial made my mom proud of me
My friends in ROBLOX proud of me
If anyone is having problems cause their player sprite is colliding into walls while jumping, or it's got a weird dragging effect;
Make sure your origin point is set to Middle Centre for all of your sprites (thanks T8ble)
Check to see what your oPlayer object's Collision Mask is. Looks like it should be sPlayer.
thank you so much bro.
THANK YOU!!
it is still draggin
Thank you Dante, I was so damn confused
Thank you 💗Thank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank youThank you💕
for anyone who resized their character ingame and is having issue with the flipping, i used this
//you could probably change the amount of times you add "sign(hsp)"
// make it add itself till its equal to the amount of size its supposed to be
if (hsp != 0) image_xscale = sign(hsp) + sign(hsp);
Thanks! looking for a fix for that exact problem
this was SO HELPFUL tysm
YOU ARE A LIFE SAVER TYSMM
it teleports
THANK YOU IT WORKED you da best
this series has already been so useful, i have been learning GML on my own now too, i could probably do all the movement again without a tutorial now, thx for this, time for guns now!
thanks for making this tutorial series! I know it has been a few years, but it helped me understand coding a platformer type game. I have been practicing with some sprites following along and it's been fun learning this. I hope to actually get to make my first real platformer sometime soon. :3
yeah i understand...
*(notices that i just followed everything he did and didn't listen to anything he said)*
Savage - Mobile Legends that's so me XD
Savage - Mobile Legends why mine split when i go left or right
That's so meee
@@djheavenagl4679 you need to put the origin point to middle center to all sprites.
:3
I did listen, but the first video I slowed the velocity down, it helped me
This tutorial is amazing and is essentially my introduction to coding, but I do very much wish you would cover animating asymmetrical sprites, instead of just flipping the sprite to face your ideal direction. Everything I've tried just impedes the player character's movement. It'd be very much appreciated!
Try doing a sign hsp check for the direction
A lot of people's problem here comes from the collision mask of sPlayer I think. I set it to automatic and all of my problems disappeared. Thumbs up for people to see it !
thx
Change the collision mask in the object properties from "same as sprite" to s_player also worked for me :3
I made an idle animation for my character to bob up and down. For some reason, when he is standing on the ground, he will lift upward when the bobbing down animation starts. Any idea how to fix this?
Yo! My guy! This fixed like 3 issues I was having! Thank you.
TTTTHHHXXXXXXXXXXX YOUR THE BEST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
Thank you so much for these tutorials! I started off making games from scratch in python/pygame and after my 3rd game i had enough so I came to GameMaker Studio 2 and your tutorials are helping me alot.
Thank you for these. As you say... "Beautiful, Elegant" way of handling these tutorials. Keep it up M8.
general tip, put this in your create event:
sIdle = sPlayerIdle
sRun = sPlayerRun
sFall = sPlayerFall
this will basicly allow you to refer to sprites as sIdle and sFall in a simpler way.
and if you end up changing the name of a sprite you can change the sprite here without having to go trough and manually changing all sprites
hey, ı have a problem with movment, when my player hit the ground all animations work wery well but my player just dosn't move any more, ı can control it when ı jump it but when touch the ground it just dosn't move. Can you help me ?
@@atakancanpolat1103 `this can be caused by multiple things.
number 1: collision mask. if you switch to a different sprite you also switch the collision mask, meaning that during the transition from fall to idle/walk the coll mask might get stuck in the floor. this is fixed by just having the same collision mask for all sprites or setting the standart collision mask in your player object.
number 2: not checking collision properly.
ive made the mistake of sometimes putting if place_meeting(x, y, oWall) instead of if place_meeting(x, y+vsp, oWall).
this makes it so that it will clip into the wall
hope this helps
@@TheSpooker9000 thank you man you literally helped me I was mad I just couldn't undesrtand why id didn't work it was all collision mask fault
@@tamaz_kamaz7980 no problem! happy i could be of help👍
thanks man i'll keep that in mind
To the people who have the problem where the character gets thinner:
if (hsp < 0) image_xscale = -3; if (hsp > 0) image_xscale = 3;
In my case the numbers were 3, but it may change depending on the sprite.
You are a LIFE saver
Thank you for posting this. This problem was making me crazy
what about if my sprite gets wide?
thank you so much omg
In case this helps anyone, my problem was similar to the top comment where it states to "Make sure your origin point is set to middle centre", but I was experiencing different behaviors than what everyone else was talking about.
Behavior: Whenever I turned my character around they would "blink" forward by about the space of an entire block (32px or 64px depending on the size of your sprites) and sometimes, if there was a wall in its path, the character would get stuck in the wall. Two things seem to have fixed this.
1. Make sure ALL the sprites have their origin points set to middle centre. I believe the "blink" effect was because the origin point was set to the top left and I *think* image_xscale will, in addition to flipping the image, will flip the origin point to the top right corner. So what happens when you turn around is hsp = move * walksp is effectively (not literately) adding 32px since the origin point moved 32px.
2. From my understanding, your collision mapping should be equally padded or you'll run into issues with your character getting stuck in the wall. What do I mean by padded? if one side is 14 pixels away from the edge of the sprite box, the other side needs to be 14 too. If you have 14 pixels of empty space on the left and 15 pixels on the right, it might cause that issue.
thanks for solve this problem and i fixed it
You're a life saver, definitely upvoting this comment, the whole origin point thing went over my head ❤
@@abdulsadek8911 Glad to hear my solution helped! Thanks for dropping a kind word.
THANK YOU SO MUCH!!!
Man, thx!!! I was wondering for an hour why the hell obj blinking. U r not just lifesaver, u r GOD
Just started this series and I'm loving it so far... very well presented. Already reworking some of the code from the first episode to customize and tweak my game. Sub easily earned.
All of your videos have helped me out so much! My dad and I have created quiet a few games because of you.
best thing about this tutorial no cap is if you don't make it turn around, then when you run, your character moonwalks backwards
Instead of reading the GMS2 user manual I wish they just had a short video recording of Shaun explaining how each function / variable works in his own words. Then I could watch those videos and think, "Okay, I get it now."
If your player still get stuck into walls,try this:
-Set collision mask to manual
-Make sure the collision mask covers all your player's feet
-Make sure that all your player sprites and their collision mask are on the same level
it works for me
You're a saint
Make sure your sprites are a consistant size 32x32, 64x64 whatever so the "feet" in one animation dont cause it to clip below the feet in another animation, enter the falling animation, collide IN the floor, and start the loop over.
5 years later - and still thank you. Was just getting a bit frustrated over this. Collision mask helped.
These videos are still super helpful 4 years on. Thanks so much.
You don't have to be sorry. I am looving every second of the explanations. It ensures we know what we are doing. Also better than not giving enough detail. We aren't in a rush because Miyamoto said good games are good forever but bad games are bad forever. Or something like that. Thank you!
Hey shaun, I love your videos but I am stuck, after I made the jump animations for some reason my player is colliding half way through the wall objects, the collision mask is set to "same as sprite" on the wall objects
You have to go to sPlayerA and sPlayerR and make sure they are set to "middle-center" as well as sPlayer. My character sprite was clipping halfway through the blocks until I changed this.
yeah i figured this out after the fact haha. thanks!
thank you soooooo much
This didn't work for me, but changing the collision mask to sPlayer from Same as Sprite worked. If that's useful to anyone else.
God thank you this was driving me nuts.
for all of the people that their character is bugging out on the ground you need to put the origin point to Middle Centre to all of your sprites
thx, i was wondering what was happening
I’ll see if this works
Thanks so much mine was broken
done that but the bug is still here
@@casian1508 restart the app(or pc) or recheck if the origin point is at middle centre on all the game sprites
Whenever i land on the ground, my idle and falling animation started flickering repeatedly while sinking into then ground. Please help?
I need help on this we need to get a bunch of likes for ppl to see this
it's a hitbox error
@@spookytheghost5877 thanks
Solved. Check all the sprites to have origin just half of the width and height of sprite and set object collision mask to the player collision mask.
@@hhcdghjjgsdrt235 Thanks man fixed my issues!
I watched this when I was just starting and now I'm watching this for the memories. Thanks for everything!
These tutorials are very useful. I needed a fresh reminder on working with Gamemaker Studio 2. Sort of works a bit different from Gamemaker 8.1
Your tutorials are awesome and help me in so so many ways. Question, will you ever make a RPG tutorial?
Michelle Chen yayayaya I want that too
I am quite sure that there is one, but it may be for GMS1
+1 for RPG tutorial
heartbeast channel has make a great rpg tutorial. FriendlyCosmonaut channel are making a great farming RPG tutorial.
heart.beast is also fantastic
My jump is odd, if I jump during my walk cycle it starts my animation with the final frame of the jump instead of the first fram. Works fine when i stand still.
I know no one probably watches this anymore but i have a problem where it is stuck on jump animation
Elaborate
Not sure if you still need this but Check the frame number while putting image index make sure to put the right one
If it’s getting stuck on the jump animation and you can’t move it anymore. It might be that you have the collision mask different than the other sprites. If it is it’s happening where whenever the jump hits the platform it gets stuck in the platform 👍
thanks a lot. you're the only one on the Internet who explained and showed how to write code that can be written in a simple game maker
Thank you so much! What would I do without you! I was looking for those kinds of tutorials everywhere and it was very difficult to find any of these! Again thank you very very much!
weird stuff : when using image_xscale = sign (hsp);
my character is stretched horizontally, i've not used any arbitrary number or anything
what did i do wrong? could it be something happening in the sprite?
nevermind i found the problem...
for those who are having the same issue :
My player Object was downscaled by default to reach 64 pixels, so when applying a xscale on the sprite, it would reset the scale of x to the original 128 pixels (but not the yscale)
so make sure your sprite is at the size it's supposed to be ingame
@@FloMoonYeah thanks, i had this problem
Thank you so much i was trying to fix this all day.
@@FloMoonYeah so how did you fix it?
@@bubko-fw7tp if you scaled ur sprite while in room0 that is why its happening, just delete ur sprite from the room and re-add it and dont mess with the size
if you have an animation for your jumping / falling animation you should change the code to this:
//Animation
if(!place_meeting(x,y+1,oWall))
{
image_speed = 0.5;
//or speed 1 is fine too
sprite_index = (putnameofanimationspritehere);
if (sign(vsp) > 0)
{
sprite_index = (putnameofanimationspritehere);
}
It does it when it jumps but as soon as it starts to fall it the animation changes how do I keep it so the animation stays until it lands on the ground ?
@@reecewelland8947 got same problem
Thanks man this helped alot
If Someone have Flipping sprite Issue, Image scaling Issue Do check this code replace it with existing Code of Image_xscale - "if (hsp != 0){
if (hsp > 0){
image_xscale = 3;
}
else image_xscale = -3;
}"
thank you so much
OMG u helped me so much thank u
Wow this was a lot of fun, I made my own sprites which was a lot of fun and helped me understand more. Your videos are really good and I'll continue with it and hopefully learn more cool stuff!
Great tutorials! Coming into this knowing code slightly, it really helps when you explain what the code does! I've made my character double jump and several other things just through your explanations!
YOU ARE THE COOLEST
The most success with gm i've had so far. Thank you.
It’s fun to finally see my character animate while walking and jumping
I followed the tutorial, have all sprite collision boxes on middle center. When I walk down a ledge my character starts glitching and slowly floats down then when it hits the ground it freezes and I cant even close the program (without using task manager) Whats going wrong???
(MY CODE VVV)
//Get Player Input
key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check_pressed(vk_space)
//Calculate Movement
var move = key_right - key_left;
hsp = move * walksp;
//Horizontal Collision
if (place_meeting (x+hsp,y,obj_wall))
{
while (!place_meeting(x + sign(hsp) , y, obj_wall))
{
x = 1 + sign(hsp);
}
hsp = 0;
}
x = x + hsp;
vsp = vsp + grv;
if (place_meeting(x,y+1,obj_wall)) && (key_jump)
{
vsp = -7;
}
//Vertical Collision
if (place_meeting (x,y+vsp,obj_wall))
{
while (!place_meeting(x , y + sign(vsp), obj_wall))
{
y = y + sign(vsp);
}
vsp = 0;
}
y = y + vsp;
//Animation
if (!place_meeting(x, y + 1, obj_wall))
{
sprite_index = spr_Airborn;
image_speed = 0;
if (sign(vsp) > 0) image_index = 1; else image_index = 0;
}
else
{
image_speed = 1;
if (hsp == 0)
{
sprite_index = spr_player;
}
else
{
sprite_index = spr_playerRunning;
}
}
if (hsp != 0) image_xscale = sign(hsp);
my origins on middle center tho
I'm having this same issue, when I find a fix I will let you know.
Got it fixed for me. Open up your player's object properties and make sure you set a mask. It's located right under where you choose a sprite and parent for the object. Once I set the mask to my spr_player it worked just fine.
TYSM!
i know im watching this xtremely late but thanks bro (:
i have a problem, my character only jumps when i include the second part with running.
For anybody that had the same problem as me: everytime i tested if the code were ok, my player would always melt into the floor like its some sort of quicksand. what I did to fix it was to replace the + by a - on the first line below //Animation
it still not working the palyer stands just fine but when he moves half of the player body is in the ground
@@kylecrane6281 yeah i got some problems too with the code that i couldnt fix even after trying multiple attempts for 4 hours
@@Mr.LowBudget the running player sprite origin point should be in middle then it will work
@@kylecrane6281 someone suggested in another comment thread to make sure the origin of the running sprite (and airborn sprite) is set to "Middle Center." We changed origin on the original sprite in the first video but this wasn't brought up again here. If that doesn't work, maybe try changing collision mask to same as spr_player (or whatever you have named your player sprite)
@@thomasttt yea it worked I was checking every Sprite again and again until I noticed the origin wasn't in the center
Dude you are the best, your tutorials are the best what i can find on youtube! Thanks for your work)
In the end i made the aniation with a complete different code because it would not with the sleep mode of the player and that the glowing eye of the player at the frame 30 is still there if you turn around (i used different sprites for right and left because the glowing eye should not switch from the right to the left eye if i turn around) however i only came up with how i can do it for myself better after i watched what you did so THANK YOU 👌❤
Ps: i really like how you explain every step for beginners, even tho i don't need it because i can write C++ and there is only a small gap between those languages it is really nice and it just shows how nice you done this series keep it up 👍
For those of you who are having glitching problems, make sure your sprites are all set to MIDDLE CENTER.
MY HERO
love you
you are an amazing human or alien i don't think a human could be this smart
THANK YOU
THANKYOUUUU SO MUCH
Shaun, I wanted to apply a somersault animation in between the jumping and falling sprites in the code. But where in the line(s):
if (!place_meeting(x,y+1,oSolid))
{
sprite_index = sShinobi_Jump;
image_speed = 0;
if (sign(vsp) > 0) image_index = 1; else image_index = 0;
}
Can I do that? Can anyone help me as well? Thank you
I am Mexican and I do not understand everything but if anything and I come here to say thank you for explaining everything so well thank you :3
This man is explaining programming fundamentals better than the rest.
These videos are great, a lot of tutorials show you how to code things but with yours I actually understand WHY the code works. Whether I'll remember it is another story lolol
okay Shaun, you are a great great teacher and you have my ammiration, but I am about to drop at the second episode. it has been one hour and half I am trying to figure out why after adding the running animation the character will never move sideways again (except when airborne, then you can slide on the side).
I have tried to remove the part of the code involved in the running animation and doing nothing else, and it goes back to normal movement.
I have tried to invert and match, the animation of running works fine if applied to the standing character. I am absolutely desperate and I am noticing a few users had the same issue. I will be a patreon supporter if you can help me!
Hey, I don't know if you still care, but I had this issue as well. I could not move left or right, except when in midair. Go back into your workspace and into your oPlayer. Mine said it was the 'same as the sprite'. Get rid of that and manually choose the corresponding player sprite. This fixed the issue for me.
@@inkblood6178 BRO TYSM I WAS STRUGGLING SO MUCH WITH THIS YOUR MY LIFE SAVER
@@inkblood6178 Thank you so much. I had the same problem too, and the fix worked.
I noticed an underscore is required before the "strip[number]" when naming a spritesheet. At first I tried it with a dash and it didn't recognise my sprite as a multiple
pklz how i can find aassets idolwoad assets it only give me amepty paper argh im so fucking maD
I can't download the assets, can you help me
Thank you so much for doing this tutorials, its very very helpfull, also funny to see my own character doing all this stuff.
For some reason while i was trying to set the jumping animation, my character could move along the room but went stucked on the "down jump" frame, so after spent a while trying to figured out what was the problem, just above the "if (!place_meeting(x,y+1,oWall))" condition i added this one ---> "if not (place_meeting(x,y+1,oWall)) sprite_index = sPlayer" and it solved my problem.
I was having the same issue. I think you missed the ! symbol, once I added it, it worked for me.
So it would be:
"if not (!place_meeting(x,y+1,oWall)) sprite_index = sPlayer"
But thanks! You helped me, I was stuck haha
THANK YOU SO MUCH
This is fun, thanks! Everything is so easy in GameMaker. And I love your explanations too.
If anyone of you have a problem with the player getting "stuck" in the ground, or just walks very unsmoothly, check your collision mask.
good luck!
OMG thank you! All I had to do was change the collision mask from "Same as Sprite" to the walking animation. Thank you!
@@TheTNTerminator thank youuuuuu
Lifesaver
@@TheTNTerminator how did you do it ?
@@burgaskilek1157 You have to change the collision mask on the object from Same as Sprite to the Walking Sprite.
help me with xscale, when i change direction, my sprite becomes thin
fixed it.
i just made it like this
If sign(hsp) != 0
{
If sign(image_xscale) != sign(hsp) image_xscale *= -1;
}
You are amazing dude thanks
Thank you so much.
When I change directions my character teleports and if I change direction near a wall my character gets stuck inside of the wall.Any help?
same
that little rant about simplifying the floor/wall checks down to a single check which is called by your further variables was something i did immediatly, for floor checks you can just use;
if (place_meeting(x,y+1,oWall))
{
on_floor = true
}
else
{
on_floor = false
}
and then every place you have (place_meeting(x,y+1,oWall))
written just replace it with (on_floor = true
) and for everytime that variable starts with an exclamation mark like so (!place_meeting(x,y+1,oWall)) simply write (on_floor = false). Can also be done for walls and ceilings super easy, so i now have 4 simple collision variables instead of checking if the player is touching the wall or not
this man is a godsend
The command "sprite_index" completely fails to work for me, so that it consistently stays in the airborne sprite. Does anybody know why this is?
did you ever figure this out?
@@oniccrim1532 Ok, it was 2 years ago, but I simply went through the episode again and redid the code, trying to understand it better
@@bluujei9573 i did the same thing hahahaha
@@bluujei9573 i wish i would’ve seen this a week ago
@@bluujei9573 just finished starting over from scratch
Everything is swell, except for the fact that when i move, my sprite goes very slim.
same
Edit: Fixed it. Whenever this happens you need to put * 2 or 1 in my case it was * 2
code :
if (hsp != 0) image_xscale = sign(hsp) * 2;
@@thebruhtrain1278 bro thank you soooo much
@@thebruhtrain1278 Thanks man!
THANK YOU SO SO OSO OSOSOSOSOSOSOOSOSOSOOSO MUTCH i almost gave up on my game cus if this
@@thebruhtrain1278 thank you for giving me the solution :)
so everytime you wanna check a variable's value on an "if" conditional we should put double equals (==) ?
Yes
this guy is singlehandedly carrying my computer science grade here 💀 im forever indebted to him
Hello Shaun! I'm doing your tutorial for a game i'm creating with lot of friends in the Global Game Jam 2021. I was trying to download the assets from the link you put in the description, but it just close right after i click.
Also congratulations for the awesome tutorial! It is fast, direct to the point and complete! :)
Umm my character gets less wide when it moves
hey friend, i know it has a long time, but it happened to me and i fixed it. Well, u just gotta test the comand image_xscale. Set diferent numbers. in mine case, 2 and -2 handled the job. My code is this:
if(hsp!=0){
image_xscale=sign(hsp)*2;
}
@@cantoobscuro1709 Thank you!!!
Your a genius! Thank you so much!
I wish i could get less wide
TanukiGaming just run the code silly
I need help, when I start to move left of right, my animation swaps through my player and my running animation. Jumping is fine, I only have trouble with running.
Me too, so after 2 years have u known how to fix it?
@@duynguyenanh6320 l have the same problem and hope to know the secret as well :P
@@thelegendarymushroom80 Do any of you know? Please answer.
@@gobro3900 I'm sorry, l do not know :C
@@thelegendarymushroom80 damn...
Help it just changes my character to its jump Sprite when on ground and air
@MegaDax Yall saying like he looks down even when on the ground because if so SAME
Sameeee pls help someone
I dont know how, but i had the same problem and i changed it this way... It worked for me... you should try it
This is what I wrote:
//Animations
if (!place_meeting(x,y,oWall))
{
sprite_index = sPlayer;
image_speed = 1;
}
if (!place_meeting(x,y+1,oWall))
{
sprite_index = sPlayerJumping;
image_speed = 1;
if (sign(vsp) > 0) image_index = 1 else image_index = 0;
}
//If it worked for you please like it to everyone see...
@@le0ndr024 It worked for Game Maker 1
@@le0ndr024 Hey, thank you! worked for me
i love this kind of tutorials thx very much bro, a hug from Spain☺
Thank you for these tutorials. These tutorials have inspired me to create and code games that i can sell on Steam. Thank you :D
when i walk my character walks through the ground. it doesnt happen when i jump, turn og stand still though, please can someone help me ? :(
i dont know
infinite
infininte
hi
Make sure your origin point is set to the middle centre.
hello!
nice tutorial, i learn a lot. But when i do the animations, the player just duplicate and the animation is too slow. The jump and the gravity just aren't the same as i set for them. As i say previously, the sprite duplicate, but the first sprite is the idle animation, and the second sprite is the run animation, same for the jump animation. Anyone here know how i can fix that?
it happend to me you just need to put a canter in the same position that is locataed on the screen were you put a colisson on your character
Make sure all your sprites used have identical collision masks. Mine were not and my character would randomly stop moving at times :p
Thanks for the tutorial. Happy to start my game making journey
I am going through this walk through as a personal project and the assets would help alot a LOT
I just wanna know the size of his sprites so I can make mine a similar size 😅
Whenever I put in the image you say it is supposed to put sprites into animation by itself but it no do dat help me please
Why when I'm moving to the left my character just get thinner?
I also have this problem. Did you figure out a solution?
@@nedsanders3246 the sprites might be with wrong sizes etc...
@Nooneimportant changing it to -2 and 2 seems to fix it but I don't know why
I liked video = true
I liked your comment = false ;)
Guys, there must be no spaces! So:
I_liked_video = true;
or
ILikedVideo = true;
thisvideosucks=false;
YouReAllRightBut_ItsGettingCringy = true
This_video_is_monologue_becuase_i_have_to_use_subtitles = true
these videos have been a real help to me so thanks for the help and for explaining things so clearly
For those of you who have issues with the running animation. Its essential you make sure the sprite collision doesnt extend farther downwards than the standing sprite. Also make sure the origins are all set to the same since the default is top left.
Thank you so much! Your comment actually is so helpful for whom is newbie like me!
my player keeps on sticking to walls
{
I have it set as middle centre btw
}
Btw any one who else is having this problem there’s a video on it but the code is pretty long but it does work
what is the video called?
DaRealFishGaming just search up how to not stick to walls in game maker
every time I jump even when I fall on the ground I continue with the frame jumping or even on the ground or jumping continues with the jumping frame
someone can help me?
YES SAME
i didnt understan your problem
I had this problem too but someone figured out that I paused the video too early. Shaun's also does that... Keep going. He resolves it in a minute.