Created
March 4, 2014 10:45
-
-
Save mada360/9344145 to your computer and use it in GitHub Desktop.
Breakout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File [Main_java_BREAKOUT.html] MAS - last created: Mon 11 Nov 2013 15:40:29 GMT | |
package breakout; | |
/** | |
* Start the game | |
* The call to startGame() in the model starts the actual play of the game | |
* All issues of mutual exclusion on access to objects etc. are ignored | |
*/ | |
public class Main{ | |
public static void main( String args[] ) | |
{ | |
while(PlayState.getPlayState() != -1){ | |
//Insert code to load main menu below | |
//Menu menu = new Menu(); | |
if(PlayState.getPlayState() == 1){ | |
Debug.trace("BreakOut"); | |
ModelBreakout model = new ModelBreakout(); | |
ViewBreakout view = new ViewBreakout(); | |
new ControllerBreakout( model, view ); | |
if(Sounds.getPlaySoundCheck() == true){ | |
Sounds.music(); | |
} | |
model.createGameObjects(); // Bricks/ bat/ ball | |
model.addObserver( view ); // Add observer to the model | |
view.setVisible(true); // Display view | |
model.startGame(); // Start play | |
break; | |
}else if(PlayState.getPlayState() == 2){ | |
//Settings menu | |
PlayState.setPlayState(0); | |
}else if(PlayState.getPlayState() == 3){ | |
//Level select | |
PlayState.setPlayState(0); | |
}else if(PlayState.getPlayState() == 4){ | |
//Exit Game | |
System.out.println("Quit"); | |
PlayState.setPlayState(-1); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment