Timer#

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

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

Public Methods:

__init__(time)

tick()

act()

Act method for timer.

Inherited from Timed

__init__()

tick()

unregister()

remove timer from board


act()[source]#

Act method for timer. Called after actual_time frames.

tick()[source]#

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()

Public Methods:

__init__(time, method[, arguments])

param time:

After time frames, the method is called

act()

Act method for timer.

Inherited from Timer

__init__(time)

tick()

act()

Act method for timer.

Inherited from Timed

__init__()

tick()

unregister()

remove timer from board

Private Methods:

_call_method()


__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()

Public Methods:

act()

Act method for timer.

Inherited from ActionTimer

__init__(time, method[, arguments])

param time:

After time frames, the method is called

act()

Act method for timer.

Inherited from Timer

__init__(time)

tick()

act()

Act method for timer.

Inherited from Timed

__init__()

tick()

unregister()

remove timer from board

Private Methods:

Inherited from ActionTimer

_call_method()


act()[source]#

Act method for timer. Called after actual_time frames.