Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do you make sprites jump?
- magnamanjang
-
Scratcher
16 posts
How do you make sprites jump?
How do you?
If you need my project then here it is! http://scratch.mit.edu/projects/45833704/
Thanks!
Magnamanjang
If you need my project then here it is! http://scratch.mit.edu/projects/45833704/
Thanks!
Magnamanjang

- drmcw
-
Scratcher
1000+ posts
How do you make sprites jump?
when [up arrow v] key pressedwould be a start for you, however I'm sure you'll soon find issues with it. You then need to rethink how you do the program, so look in the sticky topics and it should give you some ideas.
change y by (20)
- Godzillafreak
-
Scratcher
3 posts
How do you make sprites jump?
Just do this The numbers depends on how high you want the sprite to jump If you want to laugh go herehttp://scratch.mit.edu/studios/892116/
when [ space] key pressed
change y by ...
change y by -...
Last edited by Godzillafreak (Jan. 31, 2015 21:27:49)
- invisibowl
-
Scratcher
23 posts
How do you make sprites jump?
Depends. If you want to actually jump, then what drmcw suggested would be best. Otherwise (like if it's a top-down game) you could cheat like Zelda: A Link to the Past did and just have a shadow that moves in and out. Basically it would work like this - look at the scripts for Sprite8, which are also below:
Notice the
when green flag clicked
show
forever
set x to (([x position v] of [Sprite1 v]) - (0))
set y to (([y position v] of [Sprite1 v]) - (5))
if <key [space v] pressed?> then
broadcast [jump v]
glide (0.25) secs to x:(([x position v] of [Sprite1 v]) - (10)) y:(([y position v] of [Sprite1 v]) - (10))
glide (0.25) secs to x:([x position v] of [Sprite1 v]) y:(([y position v] of [Sprite1 v]) - (2))
end
end
Notice the
broadcast [jump v]block- this will theoretically help disable collision detection. For instance:
when green flag clicked
forever
if <touching [maze v] ?> then
turn cw (180) degrees
move (3) steps
end
end
when I receive [jump v]
forever
if <touching [maze v] ?> then
do (something)
you get (the idea)
end
end
- ytaha
-
Scratcher
25 posts
How do you make sprites jump?
when green flag clicked
set [velocity v] to [0 ]
forever
change [velocity v] by (-1)
if <touching [ground v] ?> then
set [velocity v] to [0]
end
change y by (velocity)
end
Last edited by ytaha (Feb. 1, 2015 12:09:03)
- brainstorm101
-
Scratcher
1000+ posts
How do you make sprites jump?
This is probably the easiest way:
when [space] key pressed
change y by (20)
- peppermintpatty5
-
Scratcher
1000+ posts
How do you make sprites jump?
There are many, many ways of making a sprite jump. In my opinion, the simulated parabola and the cosine wave method are the most accurate, but this is an easy method to get you started:
when [space v] key pressed
set [power v] to [30]
repeat until <(power) < [0.05]>
go to x: (x position) y: ((y position) + (power))
set [power v] to ((power) / (1.25)
end
repeat until <(power) > [30.0]>
go to x: (x position) y: ((y position) - (power))
set [power v] to ((power) * (1.25)
end
- ealgase
-
Scratcher
100+ posts
How do you make sprites jump?
when [up arrow v] key pressed
repeat (2)
change y by (2)
end
repeat (5)
change y by (3)
end
wait (.3) secs
repeat (2)
change y by (-2)
end
repeat (5)
change y by (-3)
end
- LexHarley
-
Scratcher
93 posts
How do you make sprites jump?
How do you?A simple, but well- animated way to have a character jump would be this:
If you need my project then here it is! http://scratch.mit.edu/projects/45833704/
Thanks!
Magnamanjang
when [Up Arrow v] key pressed
repeat (10)
wait (0.01) secs
change y by (1.5)
end
repeat (10)
wait (0.01) secs
change y by (-1.5)
end
Hope you make a great game!

Last edited by LexHarley (July 6, 2015 14:59:02)
- msilby
-
Scratcher
2 posts
How do you make sprites jump?
How do you?
If you need my project then here it is! http://scratch.mit.edu/projects/45833704/
Thanks!
Magnamanjang
I looked at your project. It looked like Pico was always jumping a short distance (which looked like a vibration). I did a quick remix using the up arrow to control the jump and simulated gravity to fall back down. Hope this is helpful.
http://scratch.mit.edu/projects/45946656/
- Discussion Forums
- » Help with Scripts
-
» How do you make sprites jump?