The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.34 / 5.00 31,296 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 10,082 ViewsHey, I've got some code here for a simple timer. When the timer counts down to zero it goes on to a "gameover" screen.
That part is fine.
I also have a system where if you get enough points you go to the "WIN" screen. However in the WIN screen, the timer still counts down and can take you to the "gameover" screen.
How do i make the timer stop once I've got to the WIN screen? The different screens are on the main timeline but different frames ofc.
Thanks in advance.
this.onEnterFrame = function() {
timerVariable = timerVariable+1;
if (timerVariable == 25) {
timer -= 1;
timerVariable = 0;
}
if (timer<0) {
timer = 0;
this.gotoAndStop("gameover");
this.onEnterFrame = function() {
timerVariable = timerVariable+1;
if (timerVariable == 25) {
timer -= 1;
timerVariable = 0;
}
if (timer<0) {
timer = 0;
this.gotoAndStop("gameover");
Please finish the code fragment, some closing braces are missing.
I'm guessing there are more codes before the close brace?
but to give you an idea,
when you go to the win screen, you can just
delete this.onEnterFrame; try this:
CurrentFrame = _currentframe
this.onEnterFrame = function() {
if(CurrentFrame==_currentframe){
timerVariable = timerVariable+1;
if (timerVariable == 25) {
timer -= 1;
timerVariable = 0;
}
}