3
$\begingroup$

with the delay actuator I set up a "timer" that adds +1 every 60ticks to a "timer" property.

Now I want it to count backwards after it reaches 4 and, when it becomes 0, again goes up to 4 and so on and so on.

Has anybody an idea how to achieve this with logic bricks? Or is python neede? Thanks for every suggestions :)

$\endgroup$
6
$\begingroup$

Logic bricks are best explained with an image :

logic brick for ZigZag timer

the basic idea is that instead of adding 1 to your “timer” you add an “increment” property. You then switch this "increment" to -1 when it reaches 4 and back to 1 (effectively +1) again when the “timer” value is back to 0

to switch the "increment" property from +1 to -1 I do some fancy math (inverting the value and doubling it)

For a simpler version, you could also do it with 2 separate logic flows like here:enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.