⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dice.java

📁 Java based Snakes and Ladders game.
💻 JAVA
字号:
// Description: This class is for the actual "pawn" of the game, the player.public class Dice{    // Variables Of class Dice        // Settings int diceValue        private int diceValue;        private int val;        public int PlayerSquare;     // The Constructor of class Dice    public Dice()    {        PlayerSquare = 0;        // run method "roll"        // roll();    }    public int roll()    {        // Roll the Dice        int val = (int)(6*Math.random() + 1);  // Range 1-6        return val;        // End of roll    }            // Method of performing a Roll to move the player.        public int PlayerRoll()    {        int playerxreturn = roll();        PlayerSquare = PlayerSquare + playerxreturn;                if (PlayerSquare >= 40) {            PlayerSquare = 40;        }                  return playerxreturn;    }            public int generatePlayerSquare()    {        return PlayerSquare;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -