Hi, so I’ve come into a bit of a dead end here, I’ve spent a few hours working on a cannon,
that has a Particle System in front of it, firing a single cannonball every second.
The thing is, I’d like the cannonball to kill the player, right now they just bounce off the player. I’ve made a Tag for all things that are supposed to ‘kill’ the player, called “Fatal”. Now, Could I somehow detect a collision with the particles, and kill the player, instead of having the cannonballs go absolutely crazy and fly into another universe? I’ve configured the game so that every object that the player collides with, and has the tag “Fatal”, kills the player. Here’s the tag code…
//Death Script, Tag Enemies and Objects with the tag "Fatal" in order for this to work!
void OnCollisionEnter(Collision other)
{
if (other.transform.tag == "Fatal")
{
Die();
}
}
//In case the character should die, just write Die (); to initiate the death.
void Die()
{
Instantiate(DeathParticles, transform.position, Quaternion.identity);
transform.position = spawn;
}
If anyone could help me create a script that allows me to make the particles (cannonballs) “Fatal” aswell, that’d be amazing! I’m also open to suggestions on new ways of making the cannonballs kill the player.
Thanks in advance!