Enemy follows player help

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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!

  • 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 ^^

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Scratch that I found where it needed to go.

    Thank you very much for your help!

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