|
-
Help needed: countdown timer
i need help with a countdown timer for my game, i need it so that when time runs out, my player dies (go to another frame).
i cant seem to find any tutorials that work well. so i have no code
Info: players instance: "player"
timer instance: "timer"
plz i need help with it asap
thanks
-
Hi, here is some code:
time = 0;//leave at 0
want_time = 15;//how many seconds you want the timer for
onEnterFrame = function(){
time+=1/30;//set 30 to the fps in your movie
timer.text = Math.ceil(time);//make the textbox called timer show the time
if(time==wanted_time){
player.gotoAndStop("die");
time = want_time
}
}
This should work fine if you past it onto the main timeline.
-
Hi, here is some code:
time = 0;//leave at 0
want_time = 15;//how many seconds you want the timer for
onEnterFrame = function(){
time+=1/30;//set 30 to the fps in your movie
timer.text = Math.ceil(time);//make the textbox called timer show the time
if(time==wanted_time){
player.gotoAndStop("die");
time = want_time
}
}
This should work fine if you past it onto the main timeline.
but it doesnt take me to the game over frame.
i need to know how to send my guy to the gameover frame (frame 3)
-
Okay
Change the line:
player.gotoAndStop("die");
To say:
player.gotoAndStop(3);
-
it still doesnt work, it just keeps going
-
Maybe try player.play(); then go into the player MC and put stop(); into the frame you want. Also maybe change if(time==wanted_time){ to if(time>=wanted_time){
-
President
I think the problem is that the variable is declared as "want_time" and in the if statement you write it as "wanted_time".
 This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.
This is my Blog!... The gaming Process
Please check out my site: Giddel Creations
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|