[Solved] Intelligent Enemy

My game have two knights, one is player and other is enemy.

  1. My enemy must attack player when it is near him.
    The enemy attack has only one attack that is
    swinging the sword towards the player.
  2. The enemy must kept on moving to find the
    player. (My game only have single platform.)
  3. The enemy only have one attack when player is
    near him other than that it should be in walking
    animation.
  4. The enemy must always face towards the player. (I tried the flip horizontal action but it only works once, when player moves to left/right after the game starts the enemy don’t face towards player.)
  1. Use Distance between two objects action…e.g. Distance between Player and Enemy is less than 1000 pixels.----->>>Change the animation of Enemy to Attack.
  2. The enemy will be keep on moving on X-axis if you use TimeBackAndForthMirror Movement as your behavior for Enemy. Decide the distance and speed and your enemy will start moving. (Change your animation to Walk too)
  3. Refer to My Point 1. (Use Invert Condition) and Change animation of Enemy to Walk.
  4. Compare position of player on X-Axis with respect to Enemy…
    e.g. If position of the player is less than Enemy ----Flip Enemy --YES/NO
    If position of the player is more than Enemy ----Flip Enemy–YES/NO
    Depending upon the position of Enemy and Player you can choose accordingly.

Feel free to contact in case you need more help…
Thanks

2 Likes

Thanks bro
But I did it in different way and it works.

1 Like

Its really nice to see that you did it at your own…

Regards