Why does it look like "self. Actor. Disableblend()" doesn't work? When the attack time is up, the value of self. A decreases, but the attack animation cannot play

        if distanceToplayer > self.detectiondistance:
            self.walking = True
            self.heading = self.standard.signedAngleDeg(varyangle)
            self.velocity = search_speed
        elif distanceToplayer < self.detectiondistance and distanceToplayer > 30:
            self.heading = self.standard.signedAngleDeg(position_vevtor2D)
            self.walking  = True
            self.velocity += position_vevtor * self.acceleration * dt
        elif self.attackWaitTimer > 0 and distanceToplayer <= 30:
            self.heading = self.standard.signedAngleDeg(position_vevtor2D)
            self.walking = False
            self.velocity = Vec3(0, 0, 0)
            self.attackWaitTimer -= dt
            if self.attackWaitTimer <= 0 :
                self.attackWaitTimer = random.uniform(0.5, 0.7)
                self.actor.play("attack")
                self.a -= 1
                print(self.a)
        if self.walking:
            self.actor.enableBlend()
            self.actor.setControlEffect('walk', 0.7)
            self.actor.setControlEffect('attack', 0.3)
            walkingControl = self.actor.getAnimControl("walk")
            if not walkingControl.isPlaying():
                self.actor.loop("walk")
                self.actor.loop("attack")
        else:
            self.actor.stop()
            self.actor.loop("stand")
            self.actor.disableBlend()
        self.actor.setH(self.heading + 180)

Iā€™m not sure, but I think that the problem may be that, while the character is walking, you continually call ā€˜actor.loop(ā€œattackā€)ā€™, which I think may be resetting the attack animation. Since the animation is continually restarted, it never gets to its second frame, and so looks as though itā€™s not playing.

I also note that if the character is not walking, you stop all animationsā€“presumably including the ā€œattackā€ animationā€“and loop the ā€œstandā€ animation. Thus, if the character attacks while not walking, the ā€œattackā€ animation will presumably not visibly play.

OK, I see. Itā€™s really caused by cycling the ā€œstandā€ animation when it stops. Thank you very much.

1 Like

Itā€™s my pleasure; Iā€™m glad if Iā€™ve been of service. :slight_smile: