Right now I have this:
Thread enemySpawner = new Thread(new Runnable() {
public void run() {
if(world.getCurrentState() == gameState.GAME) {
world.spawnEnemy(x, y);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
enemySpawner.start();
It is called in the constructor of my game. For some reason, only one enemy spawns. How do I fix this?