'Stop Timer'-Help Needed
-
I need the piston to stop, like a stopwatch after the visible box has been touched. Its for a racing game. Any ideas on how i can do it? (Everything in the .skp)
-
I used this code in the 'ontick'
To start the "timer" press "A" (the SP Controll Panel must be visible and ontouched)
if key("A")==1 setVar("start",1) setVar("stop",0) end if getVar("start")==1 setVar("time",getVar("time")+1) end if getVar("stop")==1 setVar("start",0) end
The timer stops when the box is touched by the ball
and the timer also start again when you press "A" again.if you want to reset the timer every time you press "A" (or another key)
put this line into the 'ontick' at the third line before the first 'end'.setVar("time",0)
Hope this helps!:D
-
@hpnisse said:
I used this code in the 'ontick'
To start the "timer" press "A" (the SP Controll Panel must be visible and ontouched)
> if key("A")==1 > setVar("start",1) > setVar("stop",0) > end > > if getVar("start")==1 > setVar("time",getVar("time")+1) > end > > if getVar("stop")==1 > setVar("start",0) > end >
The timer stops when the box is touched by the ball
and the timer also start again when you press "A" again.if you want to reset the timer every time you press "A" (or another key)
put this line into the 'ontick' at the third line before the first 'end'.> setVar("time",0) >
Hope this helps!:D
Thanks, but it is not want i want, i want something that starts at fraem 0 and then the timer stops like a stopwatch when the box is touched, so, that is useful, but not what i want.
-
Okey...
change the first line
if key("A")==1
to
if frame==0
all script
if frame==0 setVar("start",1) setVar("stop",0) end if getVar("start")==1 setVar("time",getVar("time")+1) end if getVar("stop")==1 setVar("start",0) end
This is exact that you searching for! (I hope)
-
-
THANKS FOR ALL YOUR HELP!
Advertisement