Discuss Scratch

HazelLeaf-Llamas
Scratcher
25 posts

How do I make a sprite jump?

I know this is a super basic question, and I should definitely know this, but I just can't figure it out! I am making a collab with @-TheWarriorGamer-, that is half a Warriors game and half a platformer. We need to figure out how to get the cat to jump and then return to the ground.
If someone could possibly explain this to me, that would be greatly appreciated.
Thank you!
`Hazel
jokebookservice1
Scratcher
1000+ posts

How do I make a sprite jump?

So to make a simple (not realistic) jump, you would do this:
whenclickedforeverifkeyup arrowpressedthenrepeat10changeyby1repeat10changeyby-1
However, to make it realistic you will want to add acceleration. It can be stored in a variable called “Y Vel”:
whenclickedforeverifnottouchingcolor?thenchangeY Velby-1elsesetY Velto0If you are touching the ground, don't sink downifkeyup arrowpressedthensetY Velto10Jumping scriptColour of the ground //Gravity scriptchangeybyYVel

Last edited by jokebookservice1 (July 8, 2016 19:10:51)

HazelLeaf-Llamas
Scratcher
25 posts

How do I make a sprite jump?

jokebookservice1 wrote:

So to make a simple (not realistic) jump, you would do this:
whenclickedforeverifkeyup arrowpressedthenrepeat10changeyby1repeat10changeyby-1
However, to make it realistic you will want to add acceleration. It can be stored in a variable called “Y Vel”:
whenclickedforeverifnottouchingcolor?thenchangeY Velby-1elsesetY Velto0If you are touching the ground, don't sink downifkeyup arrowpressedthensetY Velto10Jumping scriptchangeybyYVelColour of the ground //Gravity script


Thanks! That helped loads
jokebookservice1
Scratcher
1000+ posts

How do I make a sprite jump?

Woops, put the
changeybyYVel
Outside the if-else, I'll edit my post. Sorry about that

Powered by DjangoBB