Skip to content

timer

FreeBodyEngine.core.timer #

Timer(duration, physics=False) #

A simple countdown timer - call update() every frame while active, and check complete once time_remaining reaches zero.

Creates the timer, inactive, counting down from duration. If physics is True, update() counts down using physics_delta() (the fixed physics step) instead of delta() (the variable frame time).

active = False instance-attribute #

complete = False instance-attribute #

duration = duration instance-attribute #

physics = physics instance-attribute #

time_remaining = self.duration instance-attribute #

activate() #

Resets the timer and starts it.

deactivate() #

Stops the timer without marking it complete, and zeroes its remaining time.

update() #

Counts down time_remaining by one frame's (or physics step's) delta while active, deactivating and setting complete once it runs out.