# Autorunner - Gradually reduce number/speed.

Get help using Construct 2

### » Sun Jan 17, 2016 11:50 pm

Hi all,

I'm making an Auto runner, the way it works at the moment is, the bullet speed of all the platforms etc are set to a global variable called "Speed". this starts at 300 and is set to increase by X every X seconds, so say you've been playing for a while and your speed is up to 400 then you end up bumping into an enemy I want it to slow down back to 300 but not instantly, I want it to slow down gradually.

The only way I can think of doing this is using System > Wait .2 secondsish > Set "speed". About 15 times or so to simulate the gradual reduction but this seems a bit stupid and I'm wondering if anyone knows of another way to do it?

Thanks,
B
10
S
1
Posts: 9
Reputation: 485

### » Mon Jan 18, 2016 1:41 am

You need a flag variable for when you want the speed to be increased or decreased. So for example:

Every X seconds
---->Slow = 0
--------->Set Bullet.Speed to Bullet.Speed + X
---->Slow =1
--------->Set Bullet.Speed to Bullet.Speed - X
Bullet.Speed = 300 (You might want to make it <= because its not guaranteed you'll land on 300 exactly depending how much you are adding)
---->Set Slow = 0

Then just set Slow to 1 when you want time to slow down.
B
33
S
8
G
2
Posts: 100
Reputation: 2,635

### » Mon Jan 18, 2016 1:59 am

thatserafimkid wrote:You need a flag variable for when you want the speed to be increased or decreased. So for example:

Every X seconds
---->Slow = 0
--------->Set Bullet.Speed to Bullet.Speed + X
---->Slow =1
--------->Set Bullet.Speed to Bullet.Speed - X
Bullet.Speed = 300 (You might want to make it <= because its not guaranteed you'll land on 300 exactly depending how much you are adding)
---->Set Slow = 0

Then just set Slow to 1 when you want time to slow down.

Is there a way you can create a screencap of what this is supposed to look like in the events list? That would be the easiest way to understand this, for I also want to know how this works.
B
246
S
136
G
12
Posts: 167
Reputation: 25,965

### » Tue Jan 19, 2016 4:37 am

B
33
S
8
G
2
Posts: 100
Reputation: 2,635