Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import biuoop.GUI;
- import biuoop.KeyboardSensor;
- import java.util.List;
- public class GameFlow {
- private AnimationRunner animationRunner;
- private KeyboardSensor keyboardSensor;
- private Counter lives;
- private Counter score;
- private GUI gui;
- public GameFlow(AnimationRunner ar, KeyboardSensor keyboardSensor,GUI gui) {
- this.animationRunner=ar;
- this.keyboardSensor=keyboardSensor;
- this.lives=new Counter(3);
- this.gui= gui;
- this.score = new Counter(0);
- }
- public void runLevels(List<LevelInformation> levels) {
- for (LevelInformation levelInfo : levels) {
- GameLevel level = new GameLevel(levelInfo,
- this.keyboardSensor,
- this.animationRunner,this.gui,score,lives);
- level.initialize();
- while (levelInfo.numberOfBlocksToRemove() != 0 && this.lives.getValue() != 0) {
- level.playOneTurn();
- }
- if (this.lives.getValue()==0) {
- gui.close();
- System.exit(0);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement