Stoping the timer if the game is completed

kesh17akikesh17aki Member Posts: 8
edited September 2012 in Working with GS (Mac)
hi,, i would like to ask how to stop the timer if the game is completed. i have 2 real attributes: My Timer=1 and Start Time=0 below is my code for my actor timer.
Display Text
abs(prec(game.MyTimer,1))

Change Attribute
game.Start Time to game.Time

Rule
if attribute game.My Timer > 0
Constrain Attribute: game.My Timer to 30-( game.Time - game.Start Time )

Rule
if attribute game.My Timer = 0
Change scene to Clean again


and i have the control actor which will check if all is true,, and it will spawn the actor game completed,.


can anyone help me on this?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited September 2012
    I'm not sure I understand what you're asking. Are you wanting game.My Timer to stop being constrained to your equation after it reaches zero? I set up the same rules but without the Change Scene behavior, and the DisplayText actor shows game.My Time reaching (and staying at) zero.

    Or are you asking how to stop game.My Timer from decreasing if a certain condition is true? If it's this, then just add the condition's opposite to the Rule: "if attribute game.My TImer > 0 AND game.completed is false --> Constrain Attribute: game.My Timer to 30-( game.Time - game.Start Time ).
  • kesh17akikesh17aki Member Posts: 8
    the 2nd answer solves the problem... thank you so much for the help... :)
Sign In or Register to comment.