Enemy AI wont work

0 favourites
  • 7 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • I am making a dark souls like game with construct 2. The enemy follows me correctly however none of its animations will play. I cannot post my capx file or img so I will type my enemy AI out.

    Skeleton is on screen

    Player X > Skeleton.X Skeleton Set animation to "Default" (play from beginning)

    Skeleton set animation to "Walk"(play from beginning)

    Skeleton Simulate 8Direction pressing Right

    Skeleton Set angle to 0 degrees

    Skeleton Set Mirrored

    Player X < Skeleton.X Skeleton Set animation to "Default" (play from beginning)

    Skeleton set animation to "Walk"(play from beginning)

    Skeleton Simulate 8Direction pressing Right

    Skeleton Set angle to 0 degrees

    Skeleton Set Not Mirrored

    Player X < Skeleton.Y Skeleton Set animation to "Default" (play from beginning)

    Skeleton set animation to "UpwardWalk"(play from beginning)

    Skeleton Simulate 8Direction pressing Right

    Skeleton Set angle to 0 degrees

    Player Y > Skeleton.Y Skeleton Set animation to "Default" (play from beginning)

    Skeleton set animation to "DownwardWalk"(play from beginning)

    Skeleton Simulate 8Direction pressing Right

    Skeleton Set angle to 0 degrees

  • 1

    2

    3 Player X < Skeleton.Y Skeleton Set animation to "Default" (play from beginning)

    Skeleton set animation to "UpwardWalk"(play from beginning)

    Skeleton Simulate 8Direction pressing Right

    Skeleton Set angle to 0 degrees

    4....

    on the 3rd one you have a mismatch ... u compare X coordonate with a Y maybe thats the mistake that trows all other animations of.

  • oh no I have all the x's and y's right in the actual code I just messed it up while typing it to this fourm

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have a quick look at the skeleton's sprite object and make sure the speed and loop settings are correct. Sometimes that does it. Check out the frames as well as the complete animation and make sure it's not 0 or something. Also check to be sure the animations are correctly named and referenced (watch for case sensitivity, too!)

    In reference to your events, if you're telling it to play animation Default at the event beginning, it will probably keep changing back to default as long as the conditions are true, despite what the sub events say. Set the default animation when the skeleton is idle. Then as a separate event, set your AI conditions and actions.

    Skeleton is on screen (not necessary, but can be used with sub events under it if you're worried about performance)
         Player X > Skeleton.X Skeleton  Skeleton set animation to "Walk"(play from beginning)
                                         Skeleton Simulate 8Direction pressing Right
                                         Skeleton Set angle to 0 degrees (<-- I wonder if you might be better off with an invisible controller sprite, but that's another tutorial)
                                         Skeleton Set Mirrored[/code:qz68hz7v]
    
    I hope that's helpful. I suspect the answer lies in your first action, set animation to default.
    
    --Edit: I see the forum removed most of my formatting, so I put it within a code block. hope you can still tell what I'm doing here.
  • Have a quick look at the skeleton's sprite object and make sure the speed and loop settings are correct. Sometimes that does it. Check out the frames as well as the complete animation and make sure it's not 0 or something. Also check to be sure the animations are correctly named and referenced (watch for case sensitivity, too!)

    In reference to your events, if you're telling it to play animation Default at the event beginning, it will probably keep changing back to default as long as the conditions are true, despite what the sub events say. Set the default animation when the skeleton is idle. Then as a separate event, set your AI conditions and actions.

    Skeleton is on screen (not necessary, but can be used with sub events under it if you're worried about performance)
         Player X > Skeleton.X Skeleton  Skeleton set animation to "Walk"(play from beginning)
                                         Skeleton Simulate 8Direction pressing Right
                                         Skeleton Set angle to 0 degrees (<-- I wonder if you might be better off with an invisible controller sprite, but that's another tutorial)
                                         Skeleton Set Mirrored[/code:1xgis24n]
    
    I hope that's helpful. I suspect the answer lies in your first action, set animation to default.
    
    --Edit: I see the forum removed most of my formatting, so I put it within a code block. hope you can still tell what I'm doing here.
    

    Thank you for the advice I will see if it fixes my problem

  • Have a quick look at the skeleton's sprite object and make sure the speed and loop settings are correct. Sometimes that does it. Check out the frames as well as the complete animation and make sure it's not 0 or something. Also check to be sure the animations are correctly named and referenced (watch for case sensitivity, too!)

    In reference to your events, if you're telling it to play animation Default at the event beginning, it will probably keep changing back to default as long as the conditions are true, despite what the sub events say. Set the default animation when the skeleton is idle. Then as a separate event, set your AI conditions and actions.

    Skeleton is on screen (not necessary, but can be used with sub events under it if you're worried about performance)
         Player X > Skeleton.X Skeleton  Skeleton set animation to "Walk"(play from beginning)
                                         Skeleton Simulate 8Direction pressing Right
                                         Skeleton Set angle to 0 degrees (<-- I wonder if you might be better off with an invisible controller sprite, but that's another tutorial)
                                         Skeleton Set Mirrored[/code:2leqtkje]
    
    I hope that's helpful. I suspect the answer lies in your first action, set animation to default.
    
    --Edit: I see the forum removed most of my formatting, so I put it within a code block. hope you can still tell what I'm doing here.
    

    I tried what you said but it still wont work and I am not sure why

  • I solved my problem it seemed that it would just trigger the animation instantaneously so I just added a trigger once condition.

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