What key would you want to press to make it jump? Or do you want to make it jump when something happens?
Key Press script:
When [This Key v] Pressed Change y by (10) //The number is how far you want it to jump Wait (1) secs Change y by (-10) //Add the " - " sign in front of your original number.If something happens to make it jump:
When I Receive [Something Happens v] Change y by (10) //The number is how far you want it to jump Wait (1) secs Change y by (-10) //Add the " - " sign in front of your original number.
Offline
Wait, sorry. Here's the first script:
When [Space v] Pressed //Whatever key Change y by (10) //The number is how far you want it to jump Wait (1) secs Change y by (-10) //Add the " - " sign in front of your original number.By the way, that's just a choppy way to make it jump. There's this whole thing about gravity and velocity, and so forth that's really long. But this is just a beginner's way.
Offline
It's late and I have to go to bed really soon, so I can't leave any script or look at your project (sorry), but I can leave you this link to the wiki article on jumping.
Offline
The way I will show you uses gravity. I also added ways to glide, but you can easily remove them.
first make a variable named VelocityX and VelocityY
then implement this code.
Where it says a color, just add the color of your floor.
when gf clicked forever if <key [left arrow v] pressed?> change [velocityX v] by (-1) end if <key [right arrow v] pressed?> change [velocityX v] by (1) end if <key [up arrow v] pressed?> set [velocityY v] to [10] end if <touching color [#636363]?> set [velocityY v] to [1] end change x by (velocityX) change y by (velocityY) set [velocityX v] to ((velocityX) * (0.9)) change [velocityY v] by (-1) endAnd if you do not want to glide, add this code.
when gf clicked forever if <key [up arrow v] pressed?> set [velocityY v] to [10] end if <touching color [#636363]?> set [velocityY v] to [1] end change y by (velocityY) change [velocityY v] by (-1) endThis is how I genreally make my sprites jump.
Last edited by daniel_j (2012-07-27 08:24:14)
Offline