# Increase the speed for a certain time

Welcome
car racing game
Want to increase the speed of a car for a certain time?
Why hurry up and stop?
Where is the error in the code?

Put the timer events outside the collision events so the timer can run even if the Player is not in collision with the speed otherwise what you are doing is to reset the timer in the collision but not giving time to check.
Plus 120 seconds is a lot of time for a power up speed try lower number like 10 and check if works fine then change to 120 if you want
So the logic will be Player collides with speed then Reset timer and apply position of background2.Y() wait for the timer to reach 10 seconds and take the background2.y() +=12 and Delete or pause the timer.

@UlisesFreitas
It didnâ€™t work for me

Itâ€™s like this:

Drag this event out of the another event.

1 Like

Hi, not that way, this way

But in the second event change the 0 value to something bigger like 10, or 20 or 30 seconds and the check if works.

Doing this youâ€™re telling this:
1-
if Player is in collision with speed
Reset speed1 so the timer starts
And here change the background speed +=15

Once the timer is running then you do some check with the second event so letâ€™s check
2-
if the time of the timer speed1 is greater than x seconds
Pause the timer speed1
And here change the background speed +=12

One thing that I donâ€™t if the speed is an item if so you need to add Delete when the player is in collision with it, that should be done in the first event.

Edit:

Here look I made an example of this

1 Like

@UlisesFreitas @Muzan
okay done
many thanks

@UlisesFreitas

beautiful jigsaw puzzle " A Pixel Adventure - Alanna - The princess of puzzles"

If you explain in your channel the installation code only for puzzle
Because I looked for it and couldnâ€™t find it

Well itâ€™s a mix of various puzzles

But the added draggable behavior and do some checks to see if the puzzle pieces match the background image.

@UlisesFreitas
I donâ€™t mean like this
I mean this
Drag and drop