How do I set ai movement animation?

0 favourites
  • 8 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • I have an AI that moves randomly but I'm having trouble setting 4-direction movement animations( left, right, up, and down). I was trying to use the "is within angle" but maybe I'm not doing it right. For example I have.

    Add Event:

    Ai> within: 0.5 of: 62 > Ai > set animation "move_right"

  • What behavior are you using to move the AI?

  • I'm currently using pathfinding

  • You need to disable "Rotate object" in the behavior settings. And add this event:

    On every tick
    System For Each AI
    
    	System AI.Pathfinding.MovingAngle is within 45 degrees of 0 : AI set animation "Right"
    
    	System AI.Pathfinding.MovingAngle is within 45 degrees of 90 : AI set animation "Down"
    
    	System AI.Pathfinding.MovingAngle is within 45 degrees of 180 : AI set animation "Left"
    
    	System AI.Pathfinding.MovingAngle is within 45 degrees of 270 : AI set animation "Up"
    
  • Yes my rotate object is unchecked already, but I will try this method and see if it works.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok hopefully this is what you mean because I couldn't find

    "System AI.Pathfinding.MovingAngle" the closest I could find was "is within angle".

    So I have-

    System> Every Tick

    System> For each (Ai)

    Ai>is within angle: 45 degrees to 0

    Ai>is within angle: 45 degrees to 90

    Ai>is within angle: 45 degrees to 180

    Ai>is within angle: 45 degrees to 270

    Although the angles look right to me, I might not have it all the way down because the ai will only animate the walk right animation (45 degrees to 0).

  • No, you need System object, "Is within angle" condition.

    And if you have multiple AI sprites, these conditions should be nested inside the "System For Each AI" loop.

  • OMG, I understand

    Thank you soooooo much it works!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)