Page 1 of 1

How do I set a max Velocity?

PostPosted: Sun May 25, 2014 4:15 pm
by orugari
Hello,

I would like to limit the velocity of an object. For that, I made a condition like if Velocity > 90 set Velocity 90. But when I released key, velocity stay 90 and never go down.

Is there a way to keep normal physics but never go more than 90? :o

Re: How do I set a max Velocity?

PostPosted: Mon May 26, 2014 5:48 am
by R0J0hound
Something like this should do it:


global number speed=0

every tick
--- set speed to distance(0,0,Sprite.Physics.VelocityX,Sprite.Physics.VelocityY)

System: variable speed > 90
---- Sprite: Physics: set velocity to Sprite.Physics.VelocityX/speed*90, Sprite.Physics.VelocityY/speed*90

Re: How do I set a max Velocity?

PostPosted: Mon May 26, 2014 5:21 pm
by orugari
Work perfectly! Thank you a lot :D

Re: How do I set a max Velocity?

PostPosted: Sun Jun 12, 2016 9:49 am
by xanxion
For some reason my ball gets stuck, and things get messed up. Like things are destroyed. Makes no sense :/