Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Smooth 2D Jumping
- Vicesh
-
26 posts
Smooth 2D Jumping
I am trying to make my personal platforming engine, my jumps are just triangles, and I'm trying to recreate a parabola while moving left and right.
- NeonG4
-
1000+ posts
Smooth 2D Jumping
Currently, your jump is 2 linear lines. I am trying to make my personal platforming engine, my jumps are just triangles, and I'm trying to recreate a parabola while moving left and right.
A real jump is a parabola.
You need a velocity variable. Always change the position by the velocity. When you jump, just set the velocity to 7 or so, and for every tick, change the velocity by -1
Last edited by NeonG4 (Aug. 21, 2023 18:05:44)
- NeonG4
-
1000+ posts
Smooth 2D Jumping
A scratch tick is this: How long is a scratch tick if I may ask?
This will change by 1 for every scratch tick. It's every frame, and since scratch runs at 30fps, that's 30 ticks per second.
- Vicesh
-
26 posts
Smooth 2D Jumping
That worked, thank you. My new problem is that my resetting function (coming back to on top of the floor) Isn't fast enough.
- NeonG4
-
1000+ posts
Smooth 2D Jumping
Try putting it in a run without screen refresh block. That worked, thank you. My new problem is that my resetting function (coming back to on top of the floor) Isn't fast enough.
- Vicesh
-
26 posts
Smooth 2D Jumping
I may be doing this wrong but, when I put in the forever loop to the reset code, It lags my computer considerably.
- NeonG4
-
1000+ posts
Smooth 2D Jumping
Oh, yes you are. What will happen when you try and run an infinite process in one tick? I may be doing this wrong but, when I put in the forever loop to the reset code, It lags my computer considerably.
just remove the forever, and wrap the call in a forever.
- NeonG4
-
1000+ posts
Smooth 2D Jumping
Can you share your project? It still dips into the ground for a little bit
- NeonG4
-
1000+ posts
Smooth 2D Jumping
https://scratch.mit.edu/projects/884544861Yes, your loop needs to look something like this:
Then, the loop should look like this:
- Vicesh
-
26 posts
Smooth 2D Jumping
Thank you very much, I believe I can handle it from here
- Vicesh
-
26 posts
Smooth 2D Jumping
I also don't know how but that accidentally added double jumping, So thanks for that too! 

- Vicesh
-
26 posts
Smooth 2D Jumping
Ok. New problem, during the walljump code, it doesn't go up, it just lets go.
- NeonG4
-
1000+ posts
Smooth 2D Jumping
At this point, I think you should look up a tutorial. I thank you for asking, and being patient with me, but I am quite busy and won't be able to go through each game feature. Ok. New problem, during the walljump code, it doesn't go up, it just lets go.
- Discussion Forums
- » Help with Scripts
-
» Smooth 2D Jumping