Enemy follows player help

Get help using Construct 2

Post » Wed Jun 17, 2015 6:50 am

Hi,

I am having some issues with getting an enemy to follow the player.

I have it so that when the player enters the line of sight of the enemy set its angle towards the player and move forward. This works fine however when I try to get the animation to change from idle to attack things go silly. When the player is on the left of the enemy it plays the attack animation but when the player is on the right of the enemy it plays the idle.

I want it to play the attack animation whenever the player is in the line of sight otherwise which back to the idle animation.

Any help would be great,

Thanks!

Image
B
3
Posts: 5
Reputation: 185

Post » Wed Jun 17, 2015 7:22 am

It's because of your else.

It's misplaced. Your code is being read " If enemy is on the left set animation to attack, else set idle"

Move the else so it is conditional to the "Has object on line of sight" event and it should work ^^
B
17
S
7
Posts: 277
Reputation: 2,514

Post » Wed Jun 17, 2015 7:39 am

How do I do that? As far as I can tell I can't put the else anywhere else without it n=saying 'not valid here'

Thanks.
B
3
Posts: 5
Reputation: 185

Post » Wed Jun 17, 2015 7:46 am

Scratch that I found where it needed to go.

Thank you very much for your help!
B
3
Posts: 5
Reputation: 185


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Yahoo [Bot], yiuyiu6666 and 12 guests