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

Enemy health not decreasing

$
0
0
Okay so I have a melee system and a enemy health system, they both work and let me play in game, however the enemy's health just does not decrease for some reason? **Here are both scripts** ENEMY HEALTH #pragma strict var Health = 100; function ApplyDammage (TheDammage : int) { Health -= TheDammage; } MELEE SYSTEM #pragma strict var TheDammage : int = 50; var Distance : float; var MaxDistance : float = 1.5; function Update() { if (Input.GetButtonDown ("Fire1")) { var hit : RaycastHit; if (Physics.Raycast (transform.position, transform.TransformDirection (Vector3.forward), hit)) { Distance = hit.distance; if (Distance < MaxDistance) { hit.transform.SendMessage("ApplyDamage", TheDammage, SendMessageOptions.DontRequireReceiver); } } } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



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