Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Scripting error for fleeing enemy

$
0
0
I'm working with the A* Pathfinding Project on a 2D platformer, I just want a simple fleeing state behaviour. I have got the AI fleeing but not quite behaving how I want it to.

I'm using these two methods to get which way the enemy is facing:
Code (CSharp):
  1. private bool IsLeft()
  2.     {
  3.         return transform.localScale.x == -1;
  4.     }
  5.  
  6.     private bool IsRight()
  7.     {
  8.         return transform.localScale.x == 1;
  9.     }
Once the health of the enemy is <= 10 I call Flee which is this:...

Scripting error for fleeing enemy

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>