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

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! :slight_smile:

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:

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:

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:

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!