1
$\begingroup$

hey i want to play more than one action one after one according to user preferred action. I mean, if user wants to play ‘run’ and ‘jump’ actions, then it should play first ‘run’ action then after that should play ‘jump’ action. I used a for loop to play actions, but it only plays one action only. I also tried changing the start and end time of actions but not work.

Here is my code:

cont = bge.logic.getCurrentController()
main_arm = cont.owner
layer = 0
priority = 0
blendin = 3
mode = 0
layerWeight = 0.0
ipoFlags = 0
speed = 0.08
end = 0
count = 3 #no.of words that user input, suppose that he 
#entered 3 words that mean I should play 3 actions

for j in range(0, count):
    if main_arm.isPlayingAction(0) == False:
        data = actions[j] #actions is some kind of array which contains the 
        #action, start and end time of which user preferred actions. There are 3 
        #actions which user want to play
        action = data[0] #taking the action
        start = data[1] + end #taking the start time of above action, when loop is active, it
        #adds previous action's end time to get the current start time
        end = data[2] + start #taking the end time of above action, when loop is active, it
        #adds previous action's start time to get the current end time
        print("action played " + action)
        main_arm.playAction(action, start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)

HOPE YOU CAN HELP

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.