# Increase game speed for a short time

Member, PRO Posts: 28
edited September 2014

ok so I want my endless runner to increase in speed when the character picks up a certain item. I got that part working GREAT! the issue is it stays that speed. I want it to stop going so fast after a certain amount of time. Also when you die and restart the game starts at that speed, I want it to start at the original speed. I'd also like to make it even faster if he picks up another of the same item while he is going fast.

## Comments

• London, UKMember Posts: 2,302

OK, can you explain your method of making the speed go up? The way to go back to your original speed might be dependent on that.

• Member, PRO Posts: 28

Sure. so what I did was I made an integer called gamespeed, then a condition that if actor collides with the other actor, gamespeed=1 then if gamespeed = 1 the moving actors i made them all increase their movement to 600 (from 400)

So i tried putting a timer in there (for 5 seconds) but it doesn't affect it.

• London, UKMember Posts: 2,302
edited September 2014

Instead, try:

If they collide, in one rule --

Change attribute self.movement to self.movement +200

Timer -- after 5 seconds -- run to completion -- Change attribute self.movement to self.movement -200

• London, UKMember Posts: 2,302

That will increase speed by 200 and then after 5 seconds decrease it by 200. Also, since you are adding +200 onto the current speed, if you hit more of the item,s the speed will stack.

• Member, PRO Posts: 28

sounds great! I will try that! thanks a lot!

• London, UKMember Posts: 2,302

Cool! Let me know how it goes!

• Member, PRO Posts: 28

ok so as my obstacles are all set to move functions do I have to create a movement integer and change everything there? I'm a bit confused, I'm new to this but i'm getting the hang of basics here and there.

• London, UKMember Posts: 2,302

Can you make a screenshot of your rules?

Are you using any custom attributes? You said that so far the speeding up is working. So if that works without custom attributes being changed, so should the slowing down.

• Member, PRO Posts: 28
edited September 2014

ok the first one is the rules I set for the powerup item - note that the timer does nothing.
the second is what I set for all the obstacle actors in the game. but I set that for EACH actor in their properties. it isn't a single act, I believe that's where i'm messing up as I don't know how to make them all speed up with a single control.

• London, UKMember Posts: 2,302

OK, here goes.

Have one game attribute, called game_speed, which starts at 0.

When colliding with speed-up actor (this rule should be in that actor), change game.game_speed to game.game_speed +1 and add timer: after 5 seconds -- run to completion -- game.game_speed to game.game_speed -1

In all your moving actors that need to speed up, do:

Move at speed of 400+(game_speed*200)

That should set you up.

• Member, PRO Posts: 28

thanks a lot! I'm working on this at work where I have an older computer that doesn't always reflect what the game is supposed to do. so far (at work) the timer still isn't working. i can judge it more at home. i really appreciate the help. If i restart this should it reset my gamespeed as well or will I start fast?

• London, UKMember Posts: 2,302
edited September 2014

Game speed should reset. Here's a little video I made to show how it works (on a Mac, but should be the same on PC):

• Member, PRO Posts: 28

awesome thanks! I will test this at home tonight. it's not working at work, but that doesn't mean it isn't working.

• Member, PRO Posts: 28

For some reason I couldn't get this to work for my game HOWEVER using this info with other things i've learned I found a solution that works PERFECTLY!!

I made a control actor to regulate the speed up and boom! worked like a charm! thanks again for the help, I could not have succeeded without it!

Sign In or Register to comment.