start button w/timer HELP Thanks

kajutokajuto Member Posts: 314
edited March 2012 in Miscellaneous
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

Comments

  • POMPOM Member Posts: 2,599
    Why not simply make :
    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"

    Photobucket Roy
  • kajutokajuto Member Posts: 314
    I have set the timer for 40s how I could display 2:00s , i mean two minutes ?? And thanks 4 the help
Sign In or Register to comment.