SpawnAssistant hinzugefügt.
Sucht zufällig ein Path Tile zum spawnen für Spieler/Gegner/PowerUps.
This commit is contained in:
1 parent
0e2b431985
commit
eee7657765
1 file changed
+23
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user