start button w/timer HELP Thanks
kajuto
Member Posts: 314
hi everyone!! i also have a start button and a timer, i want to ...when start button is touch the timer start to count, so i show you 2 actor with their code. help Please and thanks in advance
Start Actor
-Rule
-when touch is pressed
-change att
-gamestartgame to false
-destroy
otherwise:
-change att
-gamestartgame to true
Timer Actor
-display text
- abs(prec(game.my Timer,1))
-change att
- gamestarttime to game.time
-Rule
-Att gamemytimer > 0
-constrain att
-game.mytimer to 40-(game.time-gamestarttime)
-Rule
- Att gamemytimer=0
-Timer
-after 2 seconds
-pause game
Start Actor
-Rule
-when touch is pressed
-change att
-gamestartgame to false
-destroy
otherwise:
-change att
-gamestartgame to true
Timer Actor
-display text
- abs(prec(game.my Timer,1))
-change att
- gamestarttime to game.time
-Rule
-Att gamemytimer > 0
-constrain att
-game.mytimer to 40-(game.time-gamestarttime)
-Rule
- Att gamemytimer=0
-Timer
-after 2 seconds
-pause game
Comments
Game attribute - integer - "Counter"
Game attribute - boolean - "start counting"
Button actor -
When touch is pressed
Change Game.start counting" TO true .
When "Game.start counting" IS true
Change "Game.Counter" TO 0 (to make sure you start from zero)
TIMER every 1 sec
Change "Game.Counter" TO "Game.Counter"+1
Display text -
"Game.Counter"
Roy