1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Need Help With Java Game

Discussion in 'Programming & Webmastering' started by QWERTY1, Nov 6, 2010.

  1. QWERTY1 New Member

    Joined:
    Nov 6, 2010
    Messages:
    2 (0.00/day)
    Thanks Received:
    1
    Hi,
    I was wondering if someone could help me! I've new to java! I'm using the IDE Netbeans. I have to create a dice game which will do the following:

    On pressing the new game button, both dice are removed from view, any message is removed from view and the roll the dice button is enabled
    On pressing the roll the dice button once after the new game started the computer’s dice will be rolled and the result displayed
    On pressing the roll the dice button a second time, the player’s dice will be rolled and the result will be displayed; the roll the dice button will then be disabled. If the player’s dice is higher than the computer’s dice, the window will display “Winner!” to the user and the score will increase by 2 points. If the player loses, the window will display “You lose” and the score will decrease by 1 point.

    I would really appreciate any help and how to do this. I am particulary confused on how to get the dices to work! Thanks in advance!
     
  2. digibucc

    digibucc

    Joined:
    May 21, 2009
    Messages:
    4,965 (2.25/day)
    Thanks Received:
    1,516
    class work?
     
  3. QWERTY1 New Member

    Joined:
    Nov 6, 2010
    Messages:
    2 (0.00/day)
    Thanks Received:
    1
    Tutorial work yes. Stuck on how to create two dice and how to switch between them one for the computer and one for the player.
     
    digibucc says thanks.
  4. digibucc

    digibucc

    Joined:
    May 21, 2009
    Messages:
    4,965 (2.25/day)
    Thanks Received:
    1,516
    yeah i don't know anything about netbeans or even Java... it just sounded exactly like that type of project... good luck!
     
  5. Kreij

    Kreij Senior Monkey Moderator Staff Member

    Joined:
    Feb 6, 2007
    Messages:
    13,881 (4.57/day)
    Thanks Received:
    5,623
    Location:
    Cheeseland (Wisconsin, USA)
    Just create two integer variables, one called PlayerDice and one called ComputerDice, which will hold the current value of the rolls.
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page