01/17/2013
After searching around for an example or tutorial of creating a mini map for an XNA game I was unable to find one, so I just built one from scratch. I setup an interface IMiniMapItem with one method:
Vector3 GetPosition();
These items need the GetPosition() method so that their dynamic positions will always be updated on the mini map. Any item we want to show up on the mini map needs to implement the interface, and then add it to the mini map:
public void Add(IMiniMapItem item)
{
MiniMapItems.Add(item);
}
There is also a Remove(IMiniMapItem item) so that items can add and remove themselves from the mini map. You can also add and remove static positioned items based on a Vector3:
public void Add(Vector3 item)
{
Vector3Items.Add(item);
}
I also setup the mini map so that it can be be re-sized to be either small, medium, or large. It can also be positioned in the top left, top right, bottom left, or bottom right corners of the screen. These settings can later be added to the settings screen.
No comments:
Post a Comment