Discuss Scratch

Vicesh
Scratcher
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
Scratcher
1000+ posts

Smooth 2D Jumping

Vicesh wrote:

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.
Currently, your jump is 2 linear lines.
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)

Vicesh
Scratcher
26 posts

Smooth 2D Jumping

How long is a scratch tick if I may ask?
NeonG4
Scratcher
1000+ posts

Smooth 2D Jumping

Vicesh wrote:

How long is a scratch tick if I may ask?
A scratch tick is this:
whenclickedforeverchangetickby1
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
Scratcher
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
Scratcher
1000+ posts

Smooth 2D Jumping

Vicesh wrote:

That worked, thank you. My new problem is that my resetting function (coming back to on top of the floor) Isn't fast enough.
Try putting it in a run without screen refresh block.
Vicesh
Scratcher
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
Scratcher
1000+ posts

Smooth 2D Jumping

Vicesh wrote:

I may be doing this wrong but, when I put in the forever loop to the reset code, It lags my computer considerably.
Oh, yes you are. What will happen when you try and run an infinite process in one tick?
just remove the forever, and wrap the call in a forever.
Vicesh
Scratcher
26 posts

Smooth 2D Jumping

defineResetiftouchingcolor?thenchangeyby1

whenclickedforeverReset
Vicesh
Scratcher
26 posts

Smooth 2D Jumping

It still dips into the ground for a little bit
NeonG4
Scratcher
1000+ posts

Smooth 2D Jumping

Vicesh wrote:

It still dips into the ground for a little bit
Can you share your project?
NeonG4
Scratcher
1000+ posts

Smooth 2D Jumping

Vicesh wrote:

https://scratch.mit.edu/projects/884544861
Yes, your loop needs to look something like this:
defineresetYiftouchingcolor?thenrepeatuntilnottouchingcolor?changeyby1setvelocityto0changeyby-1
Then, the loop should look like this:
whenclickedforeverchangevelocityby-1changeybyvelocityresetY
Vicesh
Scratcher
26 posts

Smooth 2D Jumping

Thank you very much, I believe I can handle it from here
Vicesh
Scratcher
26 posts

Smooth 2D Jumping

I also don't know how but that accidentally added double jumping, So thanks for that too!
Vicesh
Scratcher
26 posts

Smooth 2D Jumping

Ok. New problem, during the walljump code, it doesn't go up, it just lets go.
NeonG4
Scratcher
1000+ posts

Smooth 2D Jumping

Vicesh wrote:

Ok. New problem, during the walljump code, it doesn't go up, it just lets go.
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.

Powered by DjangoBB