Game maker jumping code




















For a better experience, please enable JavaScript in your browser before proceeding. Thread starter camscottbryce Start date Jul 7, Tags acceleration movement platformer. I've done a bit of searching because I thought this topic was on the old GMC but alas- I've been working with GM for a long time but still am pretty garbage when it comes to programming including drag and drop.

All I want to know is how to add acceleration to the player's movement. So that once you hold down "right," the player starts accelerating right, and once you release right, the player slows down and stops, similar to the movement in Super Mario Bros. I've tried doing this on my own but I have issues with collision and with moving in the opposite direction. EDIT: Another thing is I'm looking to do that style of "jumping" where holding down space causes you to jump higher at a non static rate , meaning that I want to be able to tap space to do a small jump, hold space to do a high jump, and be able to release space at any time to do a low-medium-high jump.

Is there an easy way of implementing this? I've tried a couple of things, between keep gravity lower when space is held or adding to the vspeed when the key is held down but both of those ended up being pretty wonky and it feels like there's another solution.

As stated earlier, I'm complete garbage when it comes to programming, so please be patient and try to explain things as you would to a beginner. I know that's a lot to ask but I'm just trying to learn, thanks. Last edited by a moderator: Jul 7, BLang Member. The way I like to do this is set up a hspd variable that actually controls the movement of the player, while the movement keys just control the variable.

So, kinda like this: Code:. TheouAegis Member. BLang said:. Feel free to ask for further explanation if you didn't understand some part of this. Hey, thanks for this, it helped a lot. That works for me!

I do have another question, though it is entirely unrelated to this thread and so I can post it elsewhere if the mods just want to close this down: I'm looking to do that style of "jumping" where holding down space causes you to jump higher at a non static rate , meaning that I want to be able to tap space to do a small jump, hold space to do a high jump, and be able to release space at any time to do a low-medium-high jump.

The solution is to change the vspeed when you release the space key. So I guess like this: Code:. Hey, no problem, man! Happy to help. What's new New posts Latest activity. YoYo Games. Log in Register. What's new. New posts. Log in. For a better experience, please enable JavaScript in your browser before proceeding. Thread starter Claudiu Start date Feb 12, Claudiu Guest. Hi to all, i will like to know if someone can help me to code a jump and fall animation for right and left i have separete sprite for bouth directions when i press again to animate a jump and a fall animation start from the first image.

I let here my code for relax,walk and run animation



0コメント

  • 1000 / 1000