Advertisement
Guest User

Untitled

a guest
May 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. import biuoop.GUI;
  2. import biuoop.KeyboardSensor;
  3. import java.util.List;
  4.  
  5. public class GameFlow {
  6. private AnimationRunner animationRunner;
  7. private KeyboardSensor keyboardSensor;
  8. private Counter lives;
  9. private Counter score;
  10. private GUI gui;
  11. public GameFlow(AnimationRunner ar, KeyboardSensor keyboardSensor,GUI gui) {
  12. this.animationRunner=ar;
  13. this.keyboardSensor=keyboardSensor;
  14. this.lives=new Counter(3);
  15. this.gui= gui;
  16. this.score = new Counter(0);
  17. }
  18.  
  19. public void runLevels(List<LevelInformation> levels) {
  20.  
  21.  
  22. for (LevelInformation levelInfo : levels) {
  23.  
  24. GameLevel level = new GameLevel(levelInfo,
  25. this.keyboardSensor,
  26. this.animationRunner,this.gui,score,lives);
  27.  
  28. level.initialize();
  29.  
  30. while (levelInfo.numberOfBlocksToRemove() != 0 && this.lives.getValue() != 0) {
  31. level.playOneTurn();
  32. }
  33.  
  34. if (this.lives.getValue()==0) {
  35. gui.close();
  36. System.exit(0);
  37. break;
  38. }
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement