[ad_1]
Recreation Improvement Stack Change is a query and reply web site for skilled and impartial recreation builders. It solely takes a minute to enroll.
Anyone can ask a query
Anyone can reply
One of the best solutions are voted up and rise to the highest
Requested
Seen
3 instances
I’ve a object with field collider that spins 360 diploma earlier than destroying itself. I’ve a whole lot of enemies spawning across the participant. The article spawns, spins and destroys itself. Think about it like scythe. However just some enemies are getting broken and a few will not be. The code is given under
personal void OnTriggerEnter2D(Collider2D collision)
{
harm(collision.gameObject);
}
void harm(GameObject different)
{
if (different.gameObject.CompareTag("Enemies"))
{
//Damaging the enemy
different.gameObject.GetComponent<Health_Enemy>().well being -= Harm;
different.gameObject.GetComponent<Health_Enemy>().examine();
}
}
```
$endgroup$
You need to log in to reply this query.
default
[ad_2]