all groups > flash actionscript > november 2004 >
You're in the

flash actionscript

group:

add seconds to timer


add seconds to timer g5604
11/18/2004 8:12:08 PM
flash actionscript:
Hi,

i have this game timer which counts down from 20 seconds:

countdown.onEnterFrame = function() {
this.timer = int(20-(getTimer()-startTime)/1000);
if (Number(this.timer) == 0) {
gotoAndStop(10); }
timer = 0;

how do i go about adding time to this counter. For example if a button is
pressed add 5 seconds to the countdown.


cheers,
Gareth :D
Re: add seconds to timer RavenWorks
11/18/2004 8:22:07 PM
startTime += 5000

Re: add seconds to timer g5604
11/18/2004 8:28:30 PM
Hi,

many thanks for your help. i had the same idea but this does not seem to do
the trick

i have on a hit test.

checkp.onEnterFrame = function() {
}
if (_root.ship_mc.hitTest(this)) {
_root.countdown.startTime += 5000

};

it does not seem to work.

if this helps here is how i defined my var.

var startTime:Number = getTimer();

cheers,
G
Re: add seconds to timer g5604
11/18/2004 8:32:05 PM
ah ha i worked it out.

AddThis Social Bookmark Button