Exemplo n.º 1
0
 private void spawnEnemies(EnemyGroup currentGroup) {
   float randomRad = (random.nextFloat() * 3.14f * 2);
   Vector2f groupCenterPosition = gameWorld.pizzaPositionFromRad(randomRad, 0.85f);
   for (int[] spawnData : currentGroup.enemyTypeInfo) {
     for (int a = 0; a < spawnData[0]; ++a) {
       gameWorld.addEntity(
           new Alien(
               gameWorld,
               groupCenterPosition.x,
               groupCenterPosition.y,
               spawnData[1],
               spawnData[2]));
     }
   }
 }
Exemplo n.º 2
0
 public void update(GameContainer container, int deltaMS) {
   if (waveStartTime == 0) {
     waveStartTime = gameWorld.getGameTime();
   }
   if (gameWorld.getGameTime() > nextSpawnTime) {
     currentWave++;
     if (currentWave < subGroups.size()) {
       if (currentWave + 1 < subGroups.size()) {
         nextSpawnTime =
             gameWorld.getGameTime() + subGroups.get(currentWave + 1).timoutSinceLastWave;
       }
       EnemyGroup currentGroup = subGroups.get(currentWave);
       for (int a = 0; a < curlevel / 5 + 1; ++a) {
         spawnEnemies(currentGroup);
       }
     }
   }
 }