I am making a platformer. I need my sprite to be able to jump and fall. I want him to be able to move sideways while in the air as well. I don't want the sprite to carry on moving either. I also need to stop in mid jump if it his a platform. Can you please post a script for me below so I can complete it. I will share it if I finish it.
Offline
Here is the entry on the Scratch Wiki for simulating gravity including some scripts!
Here you go!
Hope it helps
Last edited by Willpower (2012-12-01 08:49:11)
Offline
forever
if NOT touching color (color of the floor)
change y by -(num)
if <key up pressed> AND touching color (color of the floor)
change y by (num)
You should know how to make a sprite move left and right, include them in a different script so you can move left and right while in mid air.
Offline
JakieMcCool wrote:
forever if NOT touching color (color of the floor) change y by -(num) if <key up pressed> AND touching color (color of the floor) change y by (num)You should know how to make a sprite move left and right, include them in a different script so you can move left and right while in mid air.
Offline
I usually use something like this:
when gf clicked set [yvel v] to (0) forever change [yvel v] by (-0.2) change y by (yvel) if<touching [wall/ground v]?> set [yvel v] to ((-0.5)*(yvel)) change y by (yvel) if<touching [wall/ground v]?> change y by (yvel) end if<<key [up arrow v] pressed?> and <(yvel) > (0)>> // for jumping set [yvel v] to (5) end end
Last edited by TheSupremeOverLord (2012-12-01 12:53:23)
Offline