How do I set a max Velocity?

Just started using Construct 2? Post your questions here

Post » Sun May 25, 2014 4:15 pm

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
B
15
S
4
Posts: 57
Reputation: 1,792

Post » Mon May 26, 2014 5:48 am

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
B
94
S
33
G
118
Posts: 5,394
Reputation: 75,849

Post » Mon May 26, 2014 5:21 pm

Work perfectly! Thank you a lot :D
B
15
S
4
Posts: 57
Reputation: 1,792

Post » Sun Jun 12, 2016 9:49 am

For some reason my ball gets stuck, and things get messed up. Like things are destroyed. Makes no sense :/
B
37
S
9
G
8
Posts: 541
Reputation: 8,554


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest