Class cocos.actions.interval_actions.MoveBy

    base_actions.Action --+        
                          |        
base_actions.IntervalAction --+    
                              |    
                         MoveTo --+
                                  |
                                 MoveBy

Moves a CocosNode object x,y pixels by modifying it's position attribute. x and y are relative to the position of the object. Duration is is seconds.

Example:

# Move the sprite 50 pixels to the left in 8 seconds
action = MoveBy( (-50,0), 8 )
sprite.do( action )

Methods

  init(self, delta, duration=5)
Init method.
  start(self)
  __reversed__(self)
  __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.IntervalAction)
  __or__(self, action)
spawn operator - runs two actions in parallel action1 | action2 -> action_result
(Inherited from cocos.actions.base_actions.Action)
  done(self)
When in the worker role, this method is reliable.
(Inherited from cocos.actions.base_actions.IntervalAction)
  step(self, dt)
Dont customize this method: it will not be called when in the component role for certain composite actions (like Sequence_IntervalAction).
(Inherited from cocos.actions.base_actions.IntervalAction)
  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)
  update(self, t)
Gets called on every frame 't' is the time elapsed normalized to [0, 1] If this action takes 5 seconds to execute, t will be equal to 0 at 0 seconds.
(Inherited from cocos.actions.interval_actions.MoveTo)

Instance Variables

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

Method Details

init

init(self, delta, duration=5)
Init method.
Parameters:
delta : (x,y)
Delta coordinates
duration : float
Duration time in seconds
Overrides:
MoveTo.init

start

start(self)
Overrides:
MoveTo.start

__reversed__

__reversed__(self)
Overrides:
base_actions.Action.__reversed__