# Help In Getting A Timer Counting Down From 5 To Go Back Up To 5 When Objects Collide?

**URL:** <https://forum.kirupa.com/t/help-in-getting-a-timer-counting-down-from-5-to-go-back-up-to-5-when-objects-collide/286948>\
**Category:** flash\
**Created:** [April 23, 2009, 10:46am UTC](https://forum.kirupa.com/t/help-in-getting-a-timer-counting-down-from-5-to-go-back-up-to-5-when-objects-collide/286948 "2009-04-23T10:46:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Spinebuster](https://avatars.discourse-cdn.com/v4/letter/j/a8b319/32.png) [@Joe\_Spinebuster](https://forum.kirupa.com/u/Joe_Spinebuster)\
**Post date:** [April 23, 2009, 10:46am UTC](https://forum.kirupa.com/t/help-in-getting-a-timer-counting-down-from-5-to-go-back-up-to-5-when-objects-collide/286948/1 "2009-04-23T10:46:39Z")

</div>

Hey!

Not only am I a newcomer to these forums but I’m also very much a newcomer to ActionScript, so I hope you will have some patience if you are able to provide me with a crystal clear answer to my problem and I’m still a little lost! 🙂

Basically, I have made a flash game where the player moves around on screen and tries to collect a little ball. There a timer on the ball that counts down to 5. One of two things can happen from here:

1. If thetimer reaches 0 before the player collects the ball, the ball is moved to a new random location, the players “lives” count goes down by 1 and the timer goes back up to 5.
2. If the player collects the ball _before_ the timer reaches 0, then the player’s “score” count goes up by 1 and the ball moves to a new location with the timer going back up to 5.

My problem is that I can’t get the timer to go back up to 5! I use the following line of code to set the timer to 5 seconds at the start of the game:

```auto
var newTimer:Timer=new Timer(1000,6);

```

I also have a variable named “countdown” which is set to 5 at the start of the game, and it is this variable that is displayed above the ball. I set the variable for countdown with:

```auto
var countdown=5;

```

What I THINK would solve my problem would be if I could take the value from “newTimer” for the value for “counrdown”, rather than manually setting “coutndown” as 5, and then if I could reset “newTimer” every time the player collects the ball or loses a life.

I find that “newTimer” isn’t very easy to manipulate, however. I thought I could bind “countdown” to “newTimer” like so:

```auto
var countdown=newTimer;

```

And then simply repeat “[FONT=Arial]var newTimer:Timer=new Timer(1000,6);[/FONT]” when the timer needs topped back up. But neither of these seem to work!

Can anyone offer any suggestions? More to the point, am I making any sense?! Haha. Again I apologise for my “new at this”-ness!
