Discuss Scratch

Kismat12
Scratcher
100+ posts

How to make a ball curve

I have recently been taking a game involving throwing snowballs, but something I don't know how to do is make the snowball throw a certain amount of throwing distance with a good curve to it, please help!
deck26
Scratcher
1000+ posts

How to make a ball curve

Easiest physics for movement -

y changes by y-velocity each time through a loop but y-velociaty also changes by a negative amount (gravity) each time as well.

x changes by x-velocity but each time through the loop x-velocity is multiplied by a value less than 1 (eg 0.9) and when it gets close to 0 you just set it to 0.

That is actually all you need.
solar_sausage
Scratcher
100+ posts

How to make a ball curve

Kismat12 wrote:

I have recently been taking a game involving throwing snowballs, but something I don't know how to do is make the snowball throw a certain amount of throwing distance with a good curve to it, please help!

whenclickedsetyvelocityto5foreverchangeybyyvelocitychangeyvelocityby-0.5

this will create a simple curve for the ball. you can also do this for the speed (xvelocity) to make it slow down.

Powered by DjangoBB