[solved]Have enemy stop and attack player

  • Doing a platform game, will include c3p file, I can get the enemy go towards and follow player when within a certain range and get the attack animation to play using the overlap at offset but how do I get the enemy to stop and make the attack? I don't see an option to disable line of sight and the way I have it setup is on line of sight set follow to true so if I try to set follow to false because the player is still in that line of sight it will just turn it back to true. Maybe set the LoS to below the offset do the attack and then reset the LoS to original?

    https://drive.google.com/file/d/1RyzxkMJwlWRvhDg1g4Zon5WCSJ2k0WOg/view?usp=sharing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey rbailey83,

    i can not open your file because of the addon. But what i can see from your screenshot, it is not that hard:

    For offset comparison, use the enemys width (*x, if needed), as it automatically becomes negative when it is mirrored.

    So he attacks in both directions. For the movement of the opponent, you simply set another condition,

    which also asks if player and opponent overlap at offset.

    EDIT: If the x-offset is too high, it can happen that the enemy wont attack the player when both have nearly the same x-position

    and dont overlap at offset anymore. Make sure that the gap between offset x/-x is not greater than the players width.

  • Hey rbailey83,

    i can not open your file because of the addon. But what i can see from your screenshot, it is not that hard:

    For offset comparison, use the enemys width (*x, if needed), as it automatically becomes negative when it is mirrored.

    So he attacks in both directions. For the movement of the opponent, you simply set another condition,

    which also asks if player and opponent overlap at offset.

    EDIT: If the x-offset is too high, it can happen that the enemy wont attack the player when both have nearly the same x-position

    and dont overlap at offset anymore. Make sure that the gap between offset x/-x is not greater than the players width.

    Awesome works great thank you so much!!

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