First, I'll explain what I want to do:
I'm currently using lists to store my sprites, so that I use a foreach loop and draw all the items in a List<Sprite>.
It works great. For drawing, of course.
Thing is, if I want to do anything more to them, say like test if the mouse is over one specific sprite.
It would be great if there's a way to add a tag (or something, for that matter), that we could use to differenciate the sprites, using a list would be even more great.
In my case, I'm specifying the index of a sprite on the list to shutdown my app. Ok, I can live with it.
But when the app grows (and I intend on doing something very much mouse based), it would be great if I could do something like:
foreach (Sprite s in sprites)
if (s.GetGlobalBounds().Contains(mouseX, mouseY)&&s.Tag =="whatever")
{
//Do something
}
I'm really not sure about the difficulty in implementing such a thing and if a thing exists, I apologise. If it is something that can be added by anyone less enlightned (like myself), I surely wouldn't mind doing it.
Can anyone tell me? Thanks.