I'm creating a Pokemon-type game in Visual Studio. I'm working on the Inventory form right now.
My question is can I use a public count variable as a way to keep track of the inventory?
Setting it:
public int healthPotionCount = 0;
Then if a player encounters a healthPotion increase it's value
if(picPlayer.Bounds.IntersectsWith(hPotion.Bounds)
{
healthPotionCount++;
}
Finally using that same public variable to determine whether to show it in the inventory:
if(healthPotionCount > 0)
{
picBox.BackgroundImage = (the health potion image);
lblQuantity.Text = ""+healthPotionCount;
}
With this, my issue is that I have a lot of forms across my solution and I want this variable to be accessible by all forms. Is this logic too awkward to work?