How do I get my enemy to change its animation when moving

Get help using Construct 2

Post » Sat Jul 22, 2017 3:35 pm

I'm currently trying to have an enemy follow my player when within a certain distance setting its direction based on its location compared the the players location which works fine the only problem is the animation the sprite changes animation when moving up or down but not when left or right even though its following the same set up any ideas on what the problem is and how I can fix it? I wish I could post a .capx but I can't
B
9
S
4
Posts: 15
Reputation: 755

Post » Sat Jul 22, 2017 4:36 pm

Probably the common issue of animations overriding where it's Y is always greater or less so it plays that animation and the left to right animations get overriden. Impossible to tell without any posted events though.
B
46
S
16
G
74
Posts: 2,088
Reputation: 44,185

Post » Sun Jul 23, 2017 5:33 am

I think that must be the problem it plays the left/right animation when I set to do so when moving up and down but then wont play the up/down animation when set to moving left and right, so whatever animation is set to play while moving up and down must be overriding the left and right animation is there anyway to change that
B
9
S
4
Posts: 15
Reputation: 755

Post » Sun Jul 23, 2017 12:14 pm

What are you using to move it, MoveTo? Pathfinding? 8-direction behaviour? use these to predict what animation to play, not its difference on x,y from the player. If simulating right or angle is 0 then play right etc.
B
46
S
16
G
74
Posts: 2,088
Reputation: 44,185

Post » Mon Jul 24, 2017 5:04 am

Its using the 8-direction and its to move towards the player based on the X Y position which works perfect and the I have it set to play the different animation based on what angle its moving so if its moving is say 90 it plays the down animation if its -90 it plays the upward animation which works perfectly fine its also set to play the left/right animation when moving at a 0/180 angle but that does not work
B
9
S
4
Posts: 15
Reputation: 755


Return to How do I....?

Who is online

Users browsing this forum: unxcellent and 4 guests