SpawnAssistant hinzugefügt.

Sucht zufällig ein Path Tile zum spawnen für Spieler/Gegner/PowerUps.
This commit is contained in:
toksikk
2014-11-04 16:14:43 +01:00
parent 0e2b431985
commit eee7657765
@@ -0,0 +1,23 @@
package de.heatup.mapengine;
import java.awt.Point;
import java.util.Random;
import de.heatup.cfg.Config;
public class SpawnAssistant {
public static Point getPathLocationOnGrid() {
Point spawnPoint = null;
Random rand = new Random();
boolean foundLocation = false;
while (!foundLocation) {
int x = rand.nextInt(Config.mapMaxTilesWidth);
int y = rand.nextInt(Config.mapMaxTilesHeight);
if (MapGrid.getGridCell(x, y).isPath()) {
spawnPoint = new Point(x,y);
foundLocation = true;
}
}
return spawnPoint;
}
}