Check out the method: own.isPlayingAction(layer=0).
What you have to do is maintain some state in your object about what you are currently doing and what you should do next.
I’ve attached a sample .blend made in 2.62. In the game engine, if you hit the up-arrow then it executes actions ‘num1’, ‘num2’, ‘num1’, ‘num2’. If you hit the down-arrow it executes animations ‘num1’, ‘num2’.
It does this by remember what animation it is currently playing. When the controller runs it checks to see if there are still animations to run and if the current animation has finished, then it starts the next animation.
You start animation by setting ‘currentAnimation’ to be somewhere in the range [0, len(string)-1] and the animations will execute from where you set it. The up-arrow just starts from index 0 and the down-arrow starts from index 2.
The relevant script is:
cont = bge.logic.getCurrentController()
own = cont.owner
string = own['Text']
# See if there are a list of actions that should be executed.
if len(string) > 0 and own['currentAction'] >= 0:
# See if the next action should be executed
if own.isPlayingAction(0) == False:
# The previous Action has finished, see if we should play the next one or if we are out of actions
if own['currentAction'] + 1 > len(string):
# The last action has finished. Stop the animations
own['currentAction'] = -1
# Play the next action in the sequence.
action = getActionName(string[own['currentAction']])
own['currentAction'] += 1
own.playAction(action, 1, 59, layer=0, play_mode=bge.logic.KX_ACTION_MODE_PLAY )
"""Based on the digit provided, creates an action name."""
action = ""
action = "num" + s
print ("d-" + action)
action = "alpha" + s.upper()
print ("nd-" + action)
actions.blend (409 KB)