• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.
  • The forums have been upgraded with support for dark mode. By default it will follow the setting on your system/browser. You may override it by scrolling to the end of the page and clicking the gears icon.

Need Help With Java Game

QWERTY1

New Member
Joined
Nov 6, 2010
Messages
2 (0.00/day)
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!
 
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.
 
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.

yeah i don't know anything about netbeans or even Java... it just sounded exactly like that type of project... good luck!
 
Just create two integer variables, one called PlayerDice and one called ComputerDice, which will hold the current value of the rolls.
 
Back
Top