How to I script a "aoe" click to change multiple sprites in one click,How do I make a
Hi I am very new to unity and I am trying to make a game like the Pokémon underground minigame. So far I can make a sprite change after I click on it with the mouse but how would I make it so I am able to "break" multiple rocks with one click like in the game. I will have to figure out how to incorporate the UI elements later but I want to get a working prototype coded first.
This is my code so far.
public class Rock : MonoBehaviour{
public Sprite halfrock;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
this.gameObject.GetComponent<SpriteRenderer>().sprite = halfrock;
}
}
}
Thank you in advance!,
Your answer

Follow this Question
Related Questions
Set the username with an inputfield ? 3 Answers
2.5D platformer character turn around (180) 0 Answers
Couple of questions on my Match 3 grid class 0 Answers
how do i keep an item destroyed when i change the scene c# 0 Answers
Unity Damage game object with tag after changing tag of current one. 0 Answers