help with cycling time


(Petr Kames) #1

Hello,

My friend and I make a dream labyrinth in the Blender game engine.A user is moved to the different rooms of it with dependance on its position and time. We need a cycling time property from 0 to 9 for that.Since we cannot program I played a while with logic bricks but with no real success.Could anybody write a script for us ?
I think a Python script controller should be connected to a timer property sensor and a result of the script should be sent to a float property.The logic of the script should look something like this:

When 9n=<timerproperty<9(n+1) where n is an integer between 0 and infinity (including 0),
then cycling time property (that we want)=timerproperty-9n.

I hope I am right.If there is a different solution,please, tell me.
I thank for your help.

Petr Kames


(Ben) #2

You can add a timer property and then add an always sensor connected
to an expresion controller(expression is: timer > 9)and this connected
to a Property assign Actuator with value = 0.This will make your timer prop to be cyclic from 0 to 9.

P.S.The script would be beter but I have no time


(Doc Holiday) #3

You can use such a Python Script:


import GameLogic
Own = GameLogic.getCurrentController().getOwner()
if Own.Timer &gt; 9.0 : Own.Timer -= 9.0

Hope this helps.
Cu, Doc


(Petr Kames) #4

I did not know it was possible to make a timer zero once after it had started to run and that was the problem.Thanks a lot. Petr