How do I stop my timer that is counting up?

So in my game I have a timer that is counting up by one second every second with a integer attribute. In my game the object the actor wants last as long as possible before hitting a bullet. The higher the time the better. What I want to do though is when the actor collides with the bullet I want the clock to stop. I know this is a really simple question but for some reason I cannot get it to work.

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    edited February 2014 Accepted Answer
    First, a game attribute called: "Has Actor collided with the bullet?"

    Rule for actor, when you collide with bullet, change "Has Actor collided with the bullet?" to 'true'.

    Rule for timer: When "Has Actor collided with the bullet?" is 'false' then increase the integer attribute you are using to the score/time by 1 every second.


    . . . . .


    So, the game starts, the attribute called "Has Actor collided with the bullet?" is 'false' so the timer runs just fine . . . the actor collides with the bullet so the attribute called: "Has Actor collided with the bullet?" becomes 'true' . . . which stops the timer from working because it can only work if "Has Actor collided with the bullet?" is false . . . the timer stops.

Answers

Sign In or Register to comment.