- Home /
particle spawn issue.
//Use the 10101011 button to format your code.
var particles : ParticleEmitter;
function OnTriggerEnter (other : Collider)
{
if(other.gameObject.FindWithTag("Respawn"))
{
particles.emit = true;
}
else
{
particles.emit = false;
}
}
i have this script attatched to a poker. when the poker collides with "Respawn" which is my enemy characters... it emits a red shower of particles.(blood) the problem is... i have a few characters on screen and if you hit any one of them... only the original character that i duplicated emits the blood. if i hit the other ones nothing comes out despite all of the characters being an exact copy of one another. can someone explain why or supply an elegant solution?
i think its to do with the fact that findwithtag finds the first one only, i think your going to have to have an integer of the enemies in the scene and then do a for loop and check through them, i really suggest that you store the GameObject's in an array so that you can access them easier and control them a lot easier.
how do i create an array and assign an integer for the for loop to check through them? i'm new to this and am really anxious to learn.
You'll have to search for javascript array and do some research on your language of choice (javascript or C#).
Try switching it around so the script is on the respawn (and modify the code accordingly). Then you don't have to differentiate between them.
thanks for the response. i will do. i almost had it yesterday. so i tried a different method. ins$$anonymous$$d i just instantiated the particle much like a bullet from a gun. i created a spawn point on the character and then did a on collision enter. the thing is it still just squirts out in spurts constantly. i dont know how to make it just play on trigger. hmmm.
Your answer
Follow this Question
Related Questions
Help on a Power-Up Sequence 1 Answer
Spawning the character with camera behind it on load using c# 1 Answer
How can i loop my path instead of it ending on the lasat point 1 Answer
Spawn System Troubles 0 Answers
Waypoint Setup: How? 4 Answers