• Post Reply Bookmark Topic Watch Topic
  • New Topic

Yahtzee project JavaEditor  RSS feed

 
Marc Montree
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to make a JavaEditor applet as a project for my school.
My idea was to make a Yahtzee applet
I have made some dice with random numbers but i need to give the dice the ability to be locked and not roll again when i click the rollButton
Can anyone help me?

please keep in mind I am a beginner so I might not understand everything xD
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow... schools are still promoting the use of applets? After you're done with the assignment, you should never use applets ever again.

Anyway, you need a user interface that displays the individual dice. You can worry about locking them later. Do you think you can do this?

Welcome to CodeRanch!
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would even say what you should program the game logic first before writing a GUI.
 
Liutauras Vilda
Sheriff
Posts: 4927
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marc Montree wrote:I have to make a JavaEditor applet

Do you have any evidence in a form of written instructions, that you indeed need to create an applet? If so, please post that part of instructions so we could have a look at.
 
Marc Montree
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for all of your responds,

I don't have to make an applet but it is the only little i have learned about coding so far and it might be even harder to start all over again

all i need to know is what tools i need to use so i can 'disable' the dice and stop them from rolling :P

so far i have made some dice (just some fields with random numbers between 1 and 6 if you press a button).


 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to me that a field isn't sufficient to describe what a die is (a "die" is "one dice").  You need to know at least what its face value is and whether is has been taken out of the cup, or disabled from rolling.  Maybe it should also know how to roll itself.  So this is where you would create a class Die.  Face value and disabled from rolling would be fields and roll would be a method.  Then I'd create an array or a List of Die.  You could then create a loop and call roll() on each Die and it would know whether to change the face value or not.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!