Timer#
ActionTimer#
- class miniworlds.tools.timer.ActionTimer(time, method, arguments=None)[source]#
Calls a method after time frames.
Example
Player moves after 48 frames:
miniworlds.ActionTimer(48, player.move, 2)
Same as above with decorator:
@miniworlds.timer(frames = 24) def moving(): player.move()
Public Methods:
Inherited from
Timed
__init__
()tick
()unregister
()remove timer from world
Private Methods:
_call_method
()
LoopActionTimer#
- class miniworlds.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:
miniworlds.LoopTimer(48, player.move, 2)
Same as above with decorator:
@miniworlds.loop(frames = 24) def moving(): player.move()
Public Methods:
act
()Act method for timer.
Inherited from
ActionTimer
Inherited from
Timed
__init__
()tick
()unregister
()remove timer from world
Private Methods:
Inherited from
ActionTimer
_call_method
()