Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make smooth jumps?
- CybaWrecker
-
21 posts
How to make smooth jumps?
Hi, I need a character to, well, jump to the left. It's really simple. The code doesn't seem so simple. I need help on how to make it do that. If you can tell me, please do! It's the main mechanic of the game and I really need to know how to make it look normal, natural and smooth.
- Pixilized
-
100+ posts
How to make smooth jumps?
Use this code to make the sprite jump smoothly to the left.
when I receive [Jump Left v]
set [gravity v] to (20) //Change 20 for a higher or lower jump
repeat until <boolean you want to use to finish jumping :: operators boolean>
change y by (gravity)
change x by (-10) //Change -10 to jump farther or shorter, but making it positive will make it jump to the right
change [gravity v] by (-1) //Change -1 for stronger or weaker gravity.
End
Last edited by Pixilized (Aug. 14, 2023 20:29:02)
- CybaWrecker
-
21 posts
How to make smooth jumps?
ive never heard of gravity, which is weird since ive used scratch for 3 years. thanks a lot, but its not activated via broadcasting but i can change it. also whats boolean you want to use to finish jumping
- CybaWrecker
-
21 posts
How to make smooth jumps?
WHAT IS THIS? I DONT NEED YOUR HELP ANYMORE
- CybaWrecker
-
21 posts
How to make smooth jumps?
WAIT A SECOND, I UNDERSTAND THE REASON BEHIND THIS STUFF. THANK YOU A LOT 

- CybaWrecker
-
21 posts
How to make smooth jumps?
none of this IS HELPING (removed by moderator - please keep it polite)! (added by CybaWrecker - SHUSH IDC IF YOU'RE A MOD) I WANT A SMOOTH JUMP WITH NO GRAVITY OR VELOCITY, I JUST WANT A QUICK JUMP THAT GOES DOWN THAT LOOKS SMOOTH
Last edited by CybaWrecker (Aug. 17, 2023 19:02:14)
- Pixilized
-
100+ posts
How to make smooth jumps?
Gravity is a variable. You can’t make a smooth jump without variables.
- CybaWrecker
-
21 posts
How to make smooth jumps?
I KNOW THAT DID YOU NOT SEE MY COMMENTS NYYYYY YOU GUYS ARE REALLY ANNOYING ME
- Pixilized
-
100+ posts
How to make smooth jumps?
Could you please elaborate more clearly on your problem? Solutions and working scripts have been provided, but you don’t seem to find them helpful. You said that you don’t want velocity, or gravity, but if you want to make the jumping arc look smooth and realistic, then gravity and velocity is the only way to do that. You could manually code in smaller and different movement blocks, but that is highly inefficient and would require you to hand code that script for each sprite you want to do the motion. Additionally, every time you want to make a sprite jump in a different arc, the script would have to be hand coded again with varying values and motion. I don’t completely understand your problem, and I would like to help in any way I can.
- WindowsAdmin
-
1000+ posts
How to make smooth jumps?
Great post
(removed by moderator - please keep it polite)! (added by CybaWrecker - SHUSH IDC IF YOU'RE A MOD) I WANT A SMOOTH JUMP WITH NO GRAVITY OR VELOCITY, I JUST WANT A QUICK JUMP THAT GOES DOWN THAT LOOKS SMOOTHCalm down jamal!!!! none of this IS HELPING
Now to actually answer your question
when green flag clicked
change [y velocity v] by (15) // this is the jump script
forever
set [y velocity v] to <(y velocity) / (0.9)>
change y by (y velocity)
- CybaWrecker
-
21 posts
How to make smooth jumps?
all that happened was it went to the top of the screen. The most useless yet!
- tkroot123
-
100+ posts
How to make smooth jumps?
Uhhh this works I tested it
when [space v] key pressedAnd also don't be rude, if you be rude you may get banned
repeat (2)
change y by (10)
end
repeat (2)
change y by (5)
end
repeat (2)
change y by (3)
end
wait (0.001) secs
repeat (2)
change y by (-10)
end
repeat (2)
change y by (-5)
end
repeat (2)
change y by (-2)
end
Last edited by tkroot123 (Aug. 18, 2023 08:50:55)
- CybaWrecker
-
21 posts
How to make smooth jumps?
tysm! its so smooth, and its the exact right height, but i need it to go left as well. thanks a lot! you're the only help, and since you are, ill stop being rude Uhhh this works I tested itwhen [space v] key pressedAnd also don't be rude, if you be rude you may get banned
repeat (2)
change y by (10)
end
repeat (2)
change y by (5)
end
repeat (2)
change y by (3)
end
wait (0.001) secs
repeat (2)
change y by (-10)
end
repeat (2)
change y by (-5)
end
repeat (2)
change y by (-2)
end
- tkroot123
-
100+ posts
How to make smooth jumps?
You're welcometysm! its so smooth, and its the exact right height, but i need it to go left as well. thanks a lot! you're the only help, and since you are, ill stop being rude Uhhh this works I tested itwhen [space v] key pressedAnd also don't be rude, if you be rude you may get banned
repeat (2)
change y by (10)
end
repeat (2)
change y by (5)
end
repeat (2)
change y by (3)
end
wait (0.001) secs
repeat (2)
change y by (-10)
end
repeat (2)
change y by (-5)
end
repeat (2)
change y by (-2)
end

If you want it to go left as well then:
when [space v] key pressed
repeat (2)
change y by (10)
change x by (-4)
end
repeat (2)
change y by (5)
change x by (-4)
end
repeat (2)
change y by (3)
change x by (-4)
end
wait (0.001) secs
repeat (2)
change y by (-10)
change x by (-4)
end
repeat (2)
change y by (-5)
change x by (-4)
end
repeat (2)
change y by (-2)
change x by (-4)
end
- Dfrsea
-
8 posts
How to make smooth jumps?
Yeah this doesn’t work though CybaWrecker was right: the sprite does go to the top of the screen.Great post(removed by moderator - please keep it polite)! (added by CybaWrecker - SHUSH IDC IF YOU'RE A MOD) I WANT A SMOOTH JUMP WITH NO GRAVITY OR VELOCITY, I JUST WANT A QUICK JUMP THAT GOES DOWN THAT LOOKS SMOOTHCalm down jamal!!!! none of this IS HELPING
Now to actually answer your questionwhen green flag clicked
change [y velocity v] by (15) // this is the jump script
forever
set [y velocity v] to <(y velocity) / (0.9)>
change y by (y velocity)
- Dfrsea
-
8 posts
How to make smooth jumps?
However, here is a script with smooth gravity:
when green flag clicked
forever
if <key [up arrow/space] pressed?> then
set [ gravity] to [0]
repeat until <[gravity] = [whatever jump height you want, I used ten]>
change y by (Gravity)
change [gravity] by (whatever, you want. I used 1, which worked pretty well and was smooth)
end
repeat until <[gravity] = [0]>
change y by (Gravity)
change [gravity] by (the opposite of the first change gravity by, for me it would be -1)
end
end
end
- _turtle64
-
100+ posts
How to make smooth jumps?
Dont necropost. However, here is a script with smooth gravity:when green flag clicked
forever
if <key [up arrow/space] pressed?> then
set [ gravity] to [0]
repeat until <[gravity] = [whatever jump height you want, I used ten]>
change y by (Gravity)
change [gravity] by (whatever, you want. I used 1, which worked pretty well and was smooth)
end
repeat until <[gravity] = [0]>
change y by (Gravity)
change [gravity] by (the opposite of the first change gravity by, for me it would be -1)
end
end
end
- Discussion Forums
- » Help with Scripts
-
» How to make smooth jumps?