How to make objects slow down for a certain period of time

I’d like to make it so that when my player collides with a powerup, it slows down the movement of the obstacles. The obstacles are moving at 600 p/s. Can I make it so that it slows down for a certain period of time and then continues?

If you want to effect every single instance of the obstacles, you can store the speed in a variable and then when you set the speed of the obstacles, you can use a variable in place of the value.

So let say you have a scene variable called obstacleSpeed and the default value is 600.
Then, when you set the speed of the obstacles using events, instead of putting 600 in to the value field, you can put an expression to reference the variable and the expression is Variable(obstacleSpeed)

Then, when the player collect the powerup, you can just change the value of obstacleSpeed to 300.
Then using a timer you can set the value back to 600 after certain time.
After, don’t forget to reset and pause the timer and unpause when the player collect a power up again.


What ddabrahim said is true, that’s one of the ways you can achieve this.

There’s another way where you can use layers and time scales to achieve the same effect.

I made a video tutorial for you explaining how both ways work: How to make a slow time powerup | GDevelop 5 Tutorial - YouTube

Hope this is helpful

1 Like

@Joshua @ddabrahim thank you, much appreciated.

1 Like

if the characters are on different layers, can i still make them collide with an event?

Yup! I tested that out.

1 Like

Thanks again! I’ll try that out