Author |
Message |
orko3001
Junior WebHelper
Joined: 19 Nov 2004
Posts: 4
|
Posted:
Sat Nov 20, 2004 12:06 am (20 years, 1 month ago) |
|
How do I get the clock in my game to stop the game?
When my clock gets to 0 then it starts counting -1, -2, -3 etc...
Whereas what i want is the level to end.
I suspect it has something to do with this line (below in quotes) but am not sure what...
"if (elapsed = startCount-current)"
Here is the whole code below:
onClipEvent (load) {
start = getTimer();
startCount = 90;
}
onClipEvent (enterFrame) {
current = (getTimer()-start)/1000;
if (elapsed = startCount-current) {
counter = Math.floor(elapsed);;
} else {
_root.gotoAndStop("done");
}
}
Thankyou for your time |
|
|
|
|
Darren
Team Member
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sat Nov 20, 2004 10:37 am (20 years, 1 month ago) |
|
Your if statement doesn't have a reason to ever be false as you are just setting the value of elapsed each time.
try this...
Code: | onClipEvent (load) {
start = getTimer();
startCount = 10;
}
onClipEvent (enterFrame) {
current = (getTimer()-start)/1000;
elapsed=startCount-current
counter = Math.floor(elapsed);
if (counter <= 0) {
_root.gotoAndStop("done");
}
} |
|
|
|
|
|
orko3001
Junior WebHelper
Joined: 19 Nov 2004
Posts: 4
|
Posted:
Sat Nov 20, 2004 1:35 pm (20 years, 1 month ago) |
|
Hi m8, thanks 4 ur help - that sorted it out
The final question is how do I add a time bounus? And add multiple time bonuses? Basically if you complete the game in 30 seconds you get 100 and if you complete it in 60 seconds you get 50...
I had a go myself but this just made the score tick away until it got to 30 seconds
I want it to add to the main score on the next page - possibly in 2 boxes (Score and time bonus) then a box that adds it up...
Or 1 box...
Thanks for your help |
|
|
|
|
Darren
Team Member
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sat Nov 20, 2004 7:11 pm (20 years, 1 month ago) |
|
Take a look at this
Hit the 'game complete' button when you want to simulate game completion (not sure how this is triggered in your game). Try clicking at various times i.e. more than 60 secs left, more than 30 secs left or just let the clock run out.
I've added an increment score button just for fun and so you can see how I added them up on the complete page.
Although there are probably a 1001 better ways to do it this works and might give you some ideas.
Download source fla
Hope it helps, |
|
|
|
|
orko3001
Junior WebHelper
Joined: 19 Nov 2004
Posts: 4
|
Posted:
Sun Nov 21, 2004 12:42 am (20 years, 1 month ago) |
|
Thankyou, that really helped
The last question is if I have a Level 2, 3, 4 etc. how do I add up the score from each level?
Would I have to name the "totalScore" something different after each level? And then get it to add up after the last level?
Thankyou for your time |
|
|
|
|
Darren
Team Member
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sun Nov 21, 2004 12:46 pm (20 years, 1 month ago) |
|
You could do if you wanted to show a full break down of scores for each level. Or you could just keep adding the level score to an overall total
levelScore = score + timeBonus
totalScore = totalScore + levelScore
or
totalScore = totalScore + score + timeBonus
should work too... |
|
|
|
|
bernalt
Junior WebHelper
Joined: 06 Dec 2014
Posts: 1
|
Posted:
Mon Dec 08, 2014 4:59 am (10 years, 1 month ago) |
|
Hi guys,I am new to this game.Thanks for your suggestions.Really more useful to us.Now i get it.I will come back shortly in this forum.Please post any tips regarding the game.Thanks Advance |
________________________________ touch typing games |
|
|
|
|