Hi,
I am creating a small game where you can buy animals, food etc.
I have a class for the animals as well as the food and you can buy food through the buttons (a "+" and a "-" button) and the same with the food.
However I have ~10 animals and the buttons to the same thing (based on the set property). Do I need to create a new Button_Click for each button?
Here is the code for one button for example:
private void penguinSub_Click(object sender, EventArgs e)
{
if (Penguin.Amount > 0)
{
Penguin.Amount -= 1;
money = money + (int)(Convert.ToDouble(Penguin.Cost * 0.9));
reloadLabels();
}
}
Also the Tiger_Button will do the exactly same thing but lower Tiger.Amount instead of Penguin.Amount (and so forth).