Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

how do i make enemy ai chase player

$
0
0
this is my code. it works but the enemy ai behaviour is weird and the hitbox is gone, i'm a beginner and this is not my code private Transform target; public int MoveSpeed = 4; public int minRange; public bool follow; public float scoreOnDeath; private Player player; void Start(){ player = GameObject.FindGameObjectWithTag ("Player").GetComponent (); GameObject go = GameObject.FindGameObjectWithTag ("Player"); target = go.transform; } public override void Die() { player.AddScore (scoreOnDeath); base.Die (); } void Update () { if(Vector3.Distance(transform.position,target.position)

Viewing all articles
Browse latest Browse all 1488

Trending Articles



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