Try this, it checks if the sprite is touching the ground colour and the up arrow ky is pressed, and then if it is, it jumps up, then comes back down.
when gf clicked forever if <<touching color [#FFFFFF]?>and<key [up arrow v] pressed?>> repeat [10] change y by [3] end repeat [10] change y by [-3] end end
Last edited by jji7skyline (2012-04-10 20:24:28)
Offline
jji7skyline wrote:
Try this, it checks if the sprite is touching the ground colour and the up arrow ky is pressed, and then if it is, it jumps up, then comes back down.
when gf clicked forever if <<touching color ()?>and<key [up arrow v] pressed?>> repeat [10] change y by [3] end repeat [10] change y by [-3] end end
More accurately:
when gf clicked forever if <touching [ground v]?> set [yvel v] to [1] if <key [up arrow v] pressed?> set [yvel v] to [5] //change this to change how high he jumps end else change [yvel v] by [-0.5] //change this to change how fast he falls back down end change y by (yvel)This covers gravity and jumping.
Offline
On the sprite that's jumping;
when green flag clicked set (y velocity) to [0] forever if <touching color [#36E813]?>//Change the colour in this block to the colour of the ground. if <key [up arrow v] pressed?> set [y velocity v] to (10) else set [y velocity v] to (1) end else change [y velocity v] by (-1) end change y by (y velocity) end
Offline
Hi.
Offline
sonicfan12p wrote:
Hi.
If you're gonna post something, make sure it's related to the thread and helpful.
Last edited by RedRocker227 (2012-04-11 10:52:58)
Offline