Timer issues -- display whole numbers

The timer is a wonderful thing, it can give accuracy up to approximately 0.000001 of a second… but when I have a visual timer in the game, how do I have it display whole numbers? (1, 2, 3, etc. rather than something like 2.203918)

Also, how can I make it count down rather than up?

i think you have to use python.

Make another property (int) and you do like this in the script

import GameLogic
cont =GameLogic.getCurrentController()
own = cont.getOwner()

own.int = int(own.timer)

Whas this clar? :slight_smile:

You can do this:


import GameLogic as GL
cont = GL.getCurrentController()
own = cont.getOwner()

own.NegTimer = -(own.timer)

You need to have a float property called “NegTimer”

Thank you both, I don’t know too much about python, but with a little bit of editing, here’s the final script:


import GameLogic as GL
cont = GL.getCurrentController()
own = cont.getOwner()

own.Text = 60 -(own.timer) 

The counter starts at 60 and goes down… The property “Text” was an integer, and “timer” was a, well, a timer. Blender rounds it off, and it goes nicely in my game!