Timer

class quest.contrib.timer.TimerMixin[source]

Maintains a clock for the game that can enforce time-based game states and elements like a countdown.

You can mix this class into a physics engine like this:

class TimedPhysicsEngine(PhysicsEngine, TimerMixin): … …

init_timer(total_game_time=None)[source]

Records the start time of the game

Parameters
  • display (Boolean) – whether to display the timer or not

  • total_game_time (int) – how much time a game should last

update()[source]

Updates the game based on the timer and stops the game from running if the total time of the game has elapsed.

time_since_start()[source]

Returns time since the start of the game.

time_remaining()[source]

Returns the time remaining or None if no total_game_time was set.