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

Gets called by __init__ with all the parameteres received, At this time the target for the action is unknown. Typical use is store parameters needed by the action.

start()

Here we must do out stuff

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

Here we must do out stuff

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

Here we must do out stuff

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

Here we must do out stuff

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

Here we must do out stuff

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

Here we must do out stuff