Enemy AI wont work

Get help using Construct 2

Post » Tue Apr 26, 2016 8:39 pm

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
B
2
Posts: 9
Reputation: 168

Post » Tue Apr 26, 2016 11:39 pm

Thegamingspyro wrote:
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.
B
76
S
22
G
69
Posts: 1,353
Reputation: 43,833

Post » Wed Apr 27, 2016 9:15 pm

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
B
2
Posts: 9
Reputation: 168

Post » Wed Apr 27, 2016 10:29 pm

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.

Code: Select all
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


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.
B
17
S
7
Posts: 21
Reputation: 1,711

Post » Thu Apr 28, 2016 6:26 pm

Davemon wrote: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.

Code: Select all
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


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
B
2
Posts: 9
Reputation: 168

Post » Thu Apr 28, 2016 10:03 pm

Davemon wrote: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.

Code: Select all
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



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
B
2
Posts: 9
Reputation: 168

Post » Mon May 09, 2016 1:29 pm

I solved my problem it seemed that it would just trigger the animation instantaneously so I just added a trigger once condition.
B
2
Posts: 9
Reputation: 168


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Calfuso and 28 guests