Package invaders101

Examples of invaders101.Game


   }

   // reorder sequence
   // extract method
   public static void play(Random rand) {
      Game aGame = new Game();

      aGame.addPlayer("Chet");
      aGame.addPlayer("Pat");
      aGame.addPlayer("Sue");

      do {

         int diceCast = rand.nextInt(5) + 1;
         aGame.moveCurrentPlayerWith(diceCast);

         boolean correctAnswer = rand.nextInt(9) != 7;
         if (correctAnswer) {
            notAWinner = aGame.currentPlayerGaveCorrectAnswer();
         } else {
            notAWinner = aGame.currentPlayerGaveWrongAnswer();
         }

      } while (notAWinner);
   }
View Full Code Here


   }

   // reorder sequence
   // extract method
   public static void play(Random rand) {
      Game aGame = new Game();

      aGame.add("Chet");
      aGame.add("Pat");
      aGame.add("Sue");

      do {

         aGame.roll(rand.nextInt(5) + 1);

         if (rand.nextInt(9) == 7) {
            notAWinner = aGame.wrongAnswer();
         } else {
            notAWinner = aGame.wasCorrectlyAnswered();
         }

      } while (notAWinner);
   }
View Full Code Here

   }

   // reorder sequence
   // extract method
   public static void play(Random rand) {
      Game aGame = new Game();

      aGame.add("Chet");
      aGame.add("Pat");
      aGame.add("Sue");

      do {

         aGame.roll(rand.nextInt(5) + 1);

         if (rand.nextInt(9) == 7) {
            notAWinner = aGame.wrongAnswer();
         } else {
            notAWinner = aGame.wasCorrectlyAnswered();
         }

      } while (notAWinner);
   }
View Full Code Here

        if (AlienBonusShip.getBonusAlienCount() > 0) {
            return;
        }
        millisToNextBonus -= delta;
        if (millisToNextBonus <= 0) {
            BaseEntity bounusAlien = new AlienBonusShip(
                    this, 50, 50,
                    0.1f + randomGenerator.nextFloat() * 0.05f);
            this.resetBonusTimer();
            this.addEntity(bounusAlien);
        }
View Full Code Here

        alienCount = 0;
        //Separaciones en X e Y entre las naves enemigas
        int separationX = 50, separationY = 45;
        for (int row = 0; row < 3; row++) { //3
            for (int x = 0; x < 11; x++) { //11
                MovingGameEntity alien = new AlienEntity(this, 100 + (x * separationX), (100) + row * separationY);
                entities.add(alien);
                alienCount++;
            }
        }
    }
View Full Code Here

    private void moveAliensForward() {
        if (logicRequiredThisLoop) {
            AlienEntity.revertGroupDirection();
            for (BaseEntity entity : entities) {
                if (entity instanceof AlienEntity) {
                    AlienEntity alien = (AlienEntity) entity;
                    alien.moveForward();
                }
            }
            logicRequiredThisLoop = false;
        }
    }
View Full Code Here

        if (AlienBonusShip.getBonusAlienCount() > 0) {
            return;
        }
        millisToNextBonus -= delta;
        if (millisToNextBonus <= 0) {
            BaseEntity bounusAlien = new AlienBonusShip(
                    this, 50, 50,
                    0.1f + randomGenerator.nextFloat() * 0.05f);
            this.resetBonusTimer();
            this.addEntity(bounusAlien);
        }
View Full Code Here

        // if a game event has indicated that game logic should
        // be resolved, cycle round every entity requesting that
        // their personal logic should be considered.
        if (logicRequiredThisLoop) {
            for (int i = 0; i < entities.size(); i++) {
                BaseEntity entity = entities.get(i);
                entity.update(delta);
            }
            logicRequiredThisLoop = false;
        }
        sprite.update(delta);
    }
View Full Code Here

        // if a game event has indicated that game logic should
        // be resolved, cycle round every entity requesting that
        // their personal logic should be considered.
        if (logicRequiredThisLoop) {
            for (int i = 0; i < entities.size(); i++) {
                BaseEntity entity = entities.get(i);
                entity.update(delta);
            }
            logicRequiredThisLoop = false;
        }
        sprite.update(delta);
    }
View Full Code Here

        // if a game event has indicated that game logic should
        // be resolved, cycle round every entity requesting that
        // their personal logic should be considered.
        if (logicRequiredThisLoop) {
            for (int i = 0; i < entities.size(); i++) {
                BaseEntity entity = entities.get(i);
                entity.update(delta);
            }
            logicRequiredThisLoop = false;
        }
        sprite.update(delta);
    }
View Full Code Here

TOP

Related Classes of invaders101.Game

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.