Hi fellow game developers... I've been trying to figure this out for a while now. How do I make blood spurt from an enemy using particles when it collides with your bullet?
Here's the script I have, for reference. (Yes, the enemy is a spider.)
var health:int = 2;
var bullet:GameObject;
var deadSpider:GameObject;
function OnCollisionEnter(bulletHit:Collision)
{
if(bulletHit.gameObject.tag == "bullet")
{
health = health - Fire.damage;
Destroy(bulletHit.gameObject);
Blood();
}
if(health <= 0)
{
Win.score = Win.score + 1;
var spiderPos = this.gameObject.transform;
Instantiate(deadSpider,spiderPos.position,spiderPos.rotation);
Destroy(gameObject);
}
}
function Blood()
{
//Make some particles emit from the object
}
↧