• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Need help with jumping issues

S

StanleyG

Guest
Hello, im using gamemaker studio 2 and im trying to create basic platformer.
Im using this simple code for jumping (in the image) and it works kinda fine except sometimes instead of normal (+60) jump my character does only very small (like +5 or +10) jump. Can somebody help me to solve it please? I got physics turned on and the event is attached to "press space" command.
jumping.jpg
 
J

Joe134

Guest
My suggestion would be to remove the + and just have phy_speed_y=60. That way phy_speed_y will always be a set value when you jump, not an addition to current phy_speed_y which could be negative (possibly leading to your object not jumping as high). If this does not solve your problem, then I'm not sure how to fix it...
 
S

StanleyG

Guest
Thank you for your suggestion, unfortunately it has no effect, the character still jumps very low sometimes
 
T

Tyler Logsdon

Guest
Are you using keyboard pressed event or keyboard event? You might have it set the yspeed to 0 when you release up
 
S

StanleyG

Guest
Nothing. I tried to switch the event to "key down" instead and when I did and held space in "game" the character just did one normal jump and when he landed he kept doing the small jumps all the time (while still holding space).
I think it has something to do with restitution, can I disable it somehow? When I set it to 0 in physics menu, my character cant jump at all.
 
S

StanleyG

Guest
Alright I solved it, I was just dumb when writing the code. The phy_speed_y = 60 was supposed to be -60. With phy 60 the force applied from top to bottom so thanks to restitution he wasnt really jumping rather than just bouncing off the surface. Also when I disabled restitution he couldnt jump because the force couldnt bounce him. With -60 it works properly even with restitution =0.
 
Top