Class cocos.actions.base_actions.Repeat

Action --+
         |
        Repeat
Repeats an action forever.
Applied to InstantAction s means once per frame.

Example:

action = JumpBy( (200,0), 50,3,5)
repeat = Repeat( action )
sprite.do( repeat )

Note: To repeat just a finite amount of time, just do action * times.

Methods

  init(self, action)
Init method.
  start(self)
External code sets self.target and then calls this method.
  step(self, dt)
Gets called every frame.
  done(self)
False while the step method must be called.
  __add__(self, action)
sequence operator - concatenates actions action1 + action2 -> action_result where action_result performs as: first do all that action1 would do; then perform all that action2 would do
(Inherited from cocos.actions.base_actions.Action)
  __init__(self, *args, **kwargs)
dont override - use init
(Inherited from cocos.actions.base_actions.Action)
  __mul__(self, other)
repeats ntimes the action action * n -> action_result where action result performs as: repeat n times the changes that action would do
(Inherited from cocos.actions.base_actions.Action)
  __or__(self, action)
spawn operator - runs two actions in parallel action1 | action2 -> action_result
(Inherited from cocos.actions.base_actions.Action)
  __reversed__(self) (Inherited from cocos.actions.base_actions.Action)
  stop(self)
When the action must cease to perform this function is called by external code; after this call no other method should be called.
(Inherited from cocos.actions.base_actions.Action)

Instance Variables

  target
CocosNode object that is the target of the action
(Inherited from cocos.actions.base_actions.Action)

Method Details

init

init(self, action)
Init method.
Parameters:
action : Action instance
The action that will be repeated
Overrides:
Action.init

start

start(self)
External code sets self.target and then calls this method. Perform here any extra initialization needed.
Overrides:
Action.start

step

step(self, dt)
Gets called every frame. dt is the number of seconds that elapsed since the last call.
Overrides:
Action.step

done

done(self)
False while the step method must be called.
Overrides:
Action.done