0
$\begingroup$

Im working in the game engine, I want to restart my game asap my character had no collision for more than 5 secs. Can you help?

$\endgroup$

1 Answer 1

2
$\begingroup$

Whenever your character measures a collision, you send a message "reset timer".

Have one object with a timer property (which measures in seconds).

  • When the property exceeds 5.0 you restart the scene (property sensor greater than mode).

  • When a message with subject "reset timer" is received set the property back to -5 (property actuator Assign mode)

[Edit] just in case the character detects constant collision, I suggest to enable [True Level Triggering] at the collision sensor. This way the message gets constantly send and the timer gets constantly reset.

$\endgroup$
3
  • $\begingroup$ I tried, when the game restarts the timer disappears (saw this in debug mode) (screen) : bit.ly/2jwZH1o $\endgroup$
    – SelmaB
    Commented Jan 18, 2017 at 15:27
  • $\begingroup$ I would not restart the game as is. Because this is really like ending and starting the game (loosing any previous information). I would restart the scene. I can't tell about "the timer disappears" this sounds strange. I never saw such behavior. I noticed with 2.78 in embedded mode the game quits, rather restarted. $\endgroup$
    – Monster
    Commented Jan 19, 2017 at 5:19
  • $\begingroup$ Thanks alot for your advice. Should've read your message better. It works well !! $\endgroup$
    – SelmaB
    Commented Jan 19, 2017 at 23:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .