I am currently making a tower defense game and would like a minimap to keep track of all the enemies. This is because enemies and other things can be off the side of the screen. I keep track of where they are by the following
This checks what is in front of the enemy, then determines if it can move or not.
The easiest way to explain is that xOffset is where the object thinks the master point if the game is, then it adds that to xPos. xPos and yPos are what changes when you move around, since the player always stays in the middle.
How would I create a minimap with moving red dots that symbolize enemies?
if((getObjectsAtOffset(50, 0, null).size() == 0))
{
xOffset += 1;
}
else
{
for(int i = 0; i < ((getObjectsAtOffset(50, 0, null).size())); i++)
{
if ((getObjectsAtOffset(50, 0, null).get(i) instanceof Wall)) count++;
}
if(count == 0) xOffset += 2;
count = 0;
timer = 0;
}setLocation(xOffset + Var.xPos, yOffset + Var.yPos);

