near timer

How do you make a timer start only when it detects a certain property with a near sensor?

Well assuming your talking about the Timer Property, you could re-star it when its near a property (assign to 0). Or you could have an always with a pulse of 60 (every second) and a near sensor.

I beleive normally a timer will start off automatic when the game begins. Now there may be a way with code to stall it till you need it. What you might be able to do is reset the value of the timer when a certain property comes in range and then record the value to a float property if you need to use the information.

Redikann a blend example would be nice.

Timer.blend (770 KB)

This is pretty straight forward. Cube.2 has motion and a property(‘Near’).
Cube.1 has a near sensor that will set a boolean property to true if cube.2 is indeed near.
in turn the true boolean property will drive the timer property to reset.

Pay attention to the debug properties in the upper left.

Remember that an object that is static has to be set to actor from the physics panel so near sensors can detect it.

Press 0 on your numpad to look thru the camera. Then start the game engine and you can watch in 1st person.

Beaten to it!

Here is a simple Python example. Press space to move a cube near to another cube with a set property. When it gets within 10 b/units the timer will start- if you move away the timer resets.


timer.blend (323 KB)

I like the python version. simplicity.

I would really like it to restart where it left off.How would i go about doing that?Because i want the timer to
trigger the steering actuator.I want many timers on one character.

if its just a matter of intervals you can use a property sensors to test the timer for a range and then run logic.

Not a timer in the strictest sense, but why not try this? It is just a property that counts down when near a certain object. When the timer object moves away the countdown stops…keys SPACE to move, and ENTER to reset counter to 1000.


interval.blend (448 KB)