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

Health drop, and picking it up.

$
0
0
I have all of the code I need for the health pickup to drop when I kill an enemy, but I have been working for about 3 days with no luck on how to get it to destroy once it's instantiated. Sorry for the messy wording but here is my code: function Dead() { Instantiate(healthDrop, enemy.transform.position, Quaternion.identity); gameObject.SetActiveRecursively(false); } This is where I am destroying the enemy and instantiating the health drop #pragma strict var player : Transform; var enemy : GameObject; function Update () { healthDropLogic(); } var distance = Vector3.Distance(player.transform.position, transform.position); function healthDropLogic () { yield WaitForSeconds(3); Destroy(gameObject); } This code is on the health drop #Any help would be much appreciated!

Viewing all articles
Browse latest Browse all 1488

Trending Articles



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