# How do I increase speed over time

Get help using Construct 2

### » Fri Dec 05, 2014 4:17 am

I have a game almost complete, but I need to increase the difficulty over time.

I am pretty sure it is an easy thing to do but I can't seem to get it to work the way I want to.

if anyone can help that would be great! or point me to a tutorial about it.

I am also having issues with Iads on my game as well.

thanks!
B
10
S
2
Posts: 22
Reputation: 651

### » Fri Dec 05, 2014 3:43 pm

i figured out the iads. just need to figure out the difficulty speed over time.
B
10
S
2
Posts: 22
Reputation: 651

### » Fri Dec 05, 2014 5:28 pm

What I did is to have a global variable called difficultyFactor, I incremented it every amount of time, then I used that factor to increment speed or anything I need to increment.

ex
Lets say:
difficultyFactor = 0
regularSpeed = 100

Then in my game sheet:
Speed = regularSpeed + (regularSpeed * difficultyFactor/10)

This wont modify the speed because difficultyFactor is 0 at this point, then after some time:

difficultyFactor = 1
Speed = regularSpeed + (regularSpeed * difficultyFactor/10)

This will increment the speed by a decimal fraction giving us 110 for speed

You can play with those values.

Also I needed to spawn some enemies at a certain difficulty, so I just did:

if (difficultyFactor > 5) spawn Enemy

I hope it helps
B
15
S
4
G
4
Posts: 134
Reputation: 3,177

### » Mon Dec 08, 2014 3:30 am

Thanks that's extactly what I was looking for!!

Have u ever tried keeping a high score in a device storage? I have an ios game and the high score does update all the time. I am using a couple global var and web storage.

Again thanks for the help on the first part!
B
10
S
2
Posts: 22
Reputation: 651