3
\$\begingroup\$

In my game there is a bird flying up and a stream of containers (baskets) is moving from right to left of the screen in the bottom. Baskets are being Instantiated on right and get destroyed when they reach the left side of the screen.

On The left there is an EmptyObject called Destroyer and anything that collides with it get destroyed. I'm not using out of bounds for the objects to get destroyed instead I'm using an EmptyObject with collide.

And on tap the bird throws an artifact projectile downwards and if it collides with the Basket it changes into another sprite. This is the code for that transform.GetComponent<SpriteRenderer> ().sprite = changedBasket;

The problem is that user is only allowed to miss 3 baskets losing more than 3 baskets will result in Game Over. So inside my Basket.cs I'm checking that if(target.gameObject.tag == "Deadly") then count it as a chance loose. BUT the changeBasket also act as it's the same basket.

The logic that I think will work is to change the tag after the artifact collides with the basket and on that type of tagged object deadly won't work. If I'm write kindly tell me how to implement this in c# of-course. Please note that the object is an Instantiated Clone

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

As this rapid google search states:

gameObject.tag="new_tag";

Obviously your "new_tag" has to exist inside the editor.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .