4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Stoping the game clock
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
orko3001
Junior WebHelper
Junior WebHelper


Joined: 19 Nov 2004
Posts: 4

PostPosted: Sat Nov 20, 2004 12:06 am (19 years, 5 months ago) Reply with QuoteBack to Top

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... Sad

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... Confused

"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 Laughing
OfflineView User's ProfileFind all posts by orko3001Send Personal Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Sat Nov 20, 2004 10:37 am (19 years, 5 months ago) Reply with QuoteBack to Top

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");
   }
}
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
orko3001
Junior WebHelper
Junior WebHelper


Joined: 19 Nov 2004
Posts: 4

PostPosted: Sat Nov 20, 2004 1:35 pm (19 years, 5 months ago) Reply with QuoteBack to Top

Hi m8, thanks 4 ur help - that sorted it out Smile

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 Confused

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... Smile

Thanks for your help
OfflineView User's ProfileFind all posts by orko3001Send Personal Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Sat Nov 20, 2004 7:11 pm (19 years, 5 months ago) Reply with QuoteBack to Top

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,
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
orko3001
Junior WebHelper
Junior WebHelper


Joined: 19 Nov 2004
Posts: 4

PostPosted: Sun Nov 21, 2004 12:42 am (19 years, 5 months ago) Reply with QuoteBack to Top

Thankyou, that really helped Smile

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 Smile
OfflineView User's ProfileFind all posts by orko3001Send Personal Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Sun Nov 21, 2004 12:46 pm (19 years, 5 months ago) Reply with QuoteBack to Top

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...
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
bernalt
Junior WebHelper
Junior WebHelper


Joined: 06 Dec 2014
Posts: 1

PostPosted: Mon Dec 08, 2014 4:59 am (9 years, 4 months ago) Reply with QuoteBack to Top

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 Very Happy

________________________________
touch typing games
OfflineView User's ProfileFind all posts by bernaltSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.225858 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme