CountdownTimer
A simple dt-driven countdown: start it with a duration, tick() it once per frame (typically from GameEntity.onUpdate()'s own dt), and check isActive() to see if time remains. Replaces a hand-rolled "duration constant + live timer field + manual decrement-and-clamp block" pattern - the same shape used for coyote time, jump/input buffering, invulnerability windows, hit-flash timers, cooldowns, etc.
This is not the same as BGE.GameTimer, which wraps a wall-clock roTimespan (mark()/totalMilliseconds()) for measuring real elapsed time - CountdownTimer is purely dt-driven and has no idea what real time it is.
Constructor
new CountdownTimer(): CountdownTimerInstance Methods
start(seconds: float): void
Starts (or restarts, from any state) the timer for the given duration, in seconds.
Parameters
seconds(float)
Returns
void
tick(dt: float): void
Advances the timer by dt seconds. Clamps at 0 - never goes negative, and is a no-op once already expired.
Parameters
dt(float)
Returns
void
isActive(): boolean
Whether time remains on this timer.
Returns
boolean
remaining(): float
Seconds remaining (never negative).
Returns
float
stop(): void
Stops the timer immediately - isActive() becomes false right away.
Returns
void