cocos.actions.instant_actions module — cocos v0.6.5 documentation

# cocos.actions.instant_actions module

Instant Actions

## Instant Actions

Instant actions are immediate actions. They don’t have a duration like the Interval Actions.

class `Place`(*args, **kwargs)

  Bases: `cocos.actions.base_actions.InstantAction`

  Place the CocosNode object in the position x,y.

  Example:

      action = Place((320,240))
      sprite.do(action)

  `init`(position)

    Init method.

    Parameters: | position : (x,y) Coordinates where the sprite will be placed

  `start`()

class `CallFunc`(*args, **kwargs)

  Bases: `cocos.actions.base_actions.InstantAction`

  An action that will call a function.

  Example:

      def my_func():
          print "hello baby"

      action = CallFunc(my_func)
      sprite.do(action)

  `init`(func, *args, **kwargs)
  `start`()

class `CallFuncS`(*args, **kwargs)

  Bases: `cocos.actions.instant_actions.CallFunc`

  An action that will call a funtion with the target as the first argument

  Example:

      def my_func(sprite):
          print "hello baby"

      action = CallFuncS(my_func)
      sprite.do(action)

  `start`()

class `Hide`(*args, **kwargs)

  Bases: `cocos.actions.base_actions.InstantAction`

  Hides the CocosNode object. To show it again call the Show () action

  Example:

      action = Hide()
      sprite.do(action)

  `start`()

class `Show`(*args, **kwargs)

  Bases: `cocos.actions.base_actions.InstantAction`

  Shows the CocosNode object. To hide it call the Hide () action

  Example:

      action = Show()
      sprite.do(action)

  `start`()

class `ToggleVisibility`(*args, **kwargs)

  Bases: `cocos.actions.base_actions.InstantAction`

  Toggles the visible attribute of a CocosNode object

  Example:

      action = ToggleVisibility()
      sprite.do(action)

  `start`()