- Home /
How do I use particles to make blood spurt from an enemy when you shoot it?
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
}
This community is not for step by step tutorials. If you want that, you're in the wrong place. This website is for specific technical questions, NOT for tutorial requests!
@Benproductions1 I'm sorry, but I thought this was a place for asking questions about Unity, and I thought a step by step tutorial would be a good way to answer my question. It was just a suggestion, your answer doesn't need to be step by step. I honestly don't think it would make any difference if I hadn't suggested a step by step tutorial. I guess I'll just remove that part so people don't get mad at me. T_T
To answer your question: You could simply use another prefab for the particle effect and instantiate it. (like the deadSpider
prefab)
People (inc. me) won't get mad at you, I was simply moderating the question, thank you for you honest response :)
Answer by superluigi · Jan 05, 2014 at 09:53 AM
I can't give you a step by step tutorial that's asking for a lot. Basically you have to create or buy the particle effect. You need to learn how to create paricle effects on your own. Then what you will do is instantiate the particle effect when your bullet and the spider collide. If u want the splatter to happen where the 2 objects collide you can have the particle effect appear in the bullets position but there are probably better ways to achieve a much better result.