Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package nexus;
- public class threadGame implements Runnable{
- public Thread game; //Thread of Game.Execute the game
- //Start of: "Thread of game"
- public synchronized void startGame(){ //This void start the game
- updateGame.gameIsOn = true; //Import updateGame and set this boolean to true
- game = new Thread(this, "Gráficos"); //Create the thread
- game.start(); //Starts the thread
- }
- public synchronized void finishGame(){ //This void end the game
- updateGame.gameIsOn = false; //Import updateGame and set this boolean to false
- try{
- game.join(); //Try to end the thread
- }catch(InterruptedException e){
- e.printStackTrace();
- }
- }
- public void run() {
- updateGame.timer(); //Imports timer
- }
- //End of: "Thread of game"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement