Timer

class miniworldmaker.tools.timer.Timer(time)[source]

Base class for timers. Calls act() Method after time frames.

act()[source]

Act method for timer. Called after actual_time frames.

ActionTimer

class miniworldmaker.tools.timer.ActionTimer(time, method, arguments=None)[source]

Calls a method after time frames.

Example

Player moves after 48 frames:

miniworldmaker.ActionTimer(48, player.move, 2)

Same as above with decorator:

@miniworldmaker.timer(frames = 24)
def moving():
    player.move()
__init__(time, method, arguments=None)[source]
Parameters
  • time (int) – After time frames, the method is called

  • method (callable) – The method to call.

  • arguments ([type], optional) – Arguments for the method.

act()[source]

Act method for timer. Called after actual_time frames.

LoopActionTimer

class miniworldmaker.tools.timer.LoopActionTimer(time, method, arguments=None)[source]

Calls a method after time frames repeatedly until the timer is unregistered.

Example

Player moves after 48 frames:

miniworldmaker.LoopTimer(48, player.move, 2)

Same as above with decorator:

@miniworldmaker.loop(frames = 24)
def moving():
    player.move()
act()[source]

Act method for timer. Called after actual_time frames.