Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package boardGame;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- import java.util.Random;
- import javax.swing.ImageIcon;
- public class Dice extends Board{
- private static Random rand = new Random();
- static ImageIcon diceRolling = new ImageIcon(Dice.class.getResource("dice.gif"));
- static ImageIcon one = new ImageIcon(Dice.class.getResource("dice1.png"));
- static ImageIcon two = new ImageIcon(Dice.class.getResource("dice2.png"));
- static ImageIcon three = new ImageIcon(Dice.class.getResource("dice3.png"));
- static ImageIcon four = new ImageIcon(Dice.class.getResource("dice4.png"));
- static ImageIcon five = new ImageIcon(Dice.class.getResource("dice5.png"));
- static ImageIcon six = new ImageIcon(Dice.class.getResource("dice6.png"));
- static ImageIcon img;
- int rollDice;
- public Dice(int d) {
- super(space);
- d = rollDice;
- }
- public void rollDice(){
- rollDice = rand.nextInt(6)+1;
- }
- public int getRollDice(){
- return rollDice;
- }
- public ImageIcon getImageIcon() {
- if(rollDice == 1){
- img = one;
- }else if(rollDice == 2){
- img = two;
- }else if(rollDice == 3){
- img = three;
- }else if(rollDice == 4){
- img = four;
- }else if(rollDice == 5){
- img = five;
- }else if(rollDice == 6){
- img = six;
- }
- return img;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement