📄 gameengine.java
字号:
// The main game engine, this is where half the work takes placepublic class GameEngine{ // The Variables of the GameEngine private Player player1, player2, currentPlayer; private Dice dice; private int PlayerMove; // The constructor of the GameEngine public GameEngine() { // initialise instance variables player1 = new Player("Player 1"); player2 = new Player("Player 2"); currentPlayer = player1; } // The methods of the GameEngine public int RunGame() { int PlayerMove = dice.PlayerRoll(); changePlayer(); return PlayerMove; } // The methods of the GameEngine public void changePlayer () { // Switch the players if (currentPlayer == player1) { currentPlayer = player2; } else if (currentPlayer == player2) { currentPlayer = player1; } else { // Check to make sure player = Legit System.out.println ("Too Many Players - Something Went Wrong."); System.exit (1); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -