Animation interval

Hey there i as wondering if its possible to set an interval for a sequence that runs the animation loop once before going into the next part of the sequence.
at the moment i am using Wait(animationlength) inside the sequence was hoping there is a better way to do animations inside sequences

nevermind i found the actorIntervall class which does that but now i am having trouble with my actor. What is the best way to have it execute animations without them interfering with each other

this is the code im using at the moment, im sure there is a better way to do it, at the moment there is always some error where it keeps on playing an animation when it shouldn’t. I think its getting confused by the variables changing when it changes animations (the sequence is still running and it sets all the check variables to false) while an animation is running causing it to become confused

I just dont know how to fix it


    def animOff(self, task):
        self.isPaused=False
        self.stopWait=False
        self.stopWalk=False
        self.stopKick=False
        self.isMoving=False
        
    def stopMove(self):
        self.isMoving=False

    

    def move(self, task):
        #move and/or turn camera
        if (self.keyMap["cam-left"]!=0):
            base.camera.setX(base.camera, -20 *globalClock.getDt())
        if (self.keyMap["cam-right"]!=0):
            base.camera.setX(base.camera, +20 * globalClock.getDt())
        if (self.keyMap["left"]!=0):
            self.actor.setH(self.actor.getH() + 300 * globalClock.getDt())
        if (self.keyMap["right"]!=0):
            self.actor.setH(self.actor.getH() - 300 * globalClock.getDt())
        if (self.keyMap["forward"]!=0) and self.isPaused is False:
            self.actor.setY(self.actor, -25 * globalClock.getDt())
        
        #do animations
        #jump animaition
        if(self.keyMap["jump"]!=0):
            #still jump/ you cant move while in a still jump
            if(self.isMoving) is False and self.isPaused is False:
                self.isPaused = True
                Sequence(self.actor.actorInterval("jump", loop=1), 
                         Func(self.animOff, "stopJump")).start()
            #running jump
            elif self.isPaused is False and self.stopWalk is False:
                stopWalk=True
                Sequence(self.actor.actorInterval("jumprun", loop=1), 
                          Func(self.animOff, "stopJump"), Func(self.stopMove)).start()
        #run animation
        elif (self.keyMap["forward"]!=0):   
            if (self.isMoving or self.isPaused or self.stopWalk) is False:
                self.stopWait=False
                self.actor.loop("walk")
                self.isMoving = True
        #kick animation/ this should be interrupted by the run animation 
        elif(self.keyMap["kick"]!=0) and (self.keyMap["forward"]==0):
            self.stopWait=True
            if (self.isMoving or self.isPaused or self.stopKick) is False :
                self.stopKick = True
                Sequence(self.actor.actorInterval("kick", loop=1), 
                         Func(self.animOff, "stopKick")).start()
        #otherwise wait animation
        else:
            if (self.isPaused or self.stopWait or self.stopWalk) is False:
                self.stopWait=True
                self.actor.loop("wait")
                self.isMoving = False

Insetad of firing off an interval inline and then forgetting it, save the interval object in your class. Then when you start a new interval, you can pause() the old one.

David