Yahtzee Design
public
class Yahtzee extends WindowController// Instance variables for the 5 dice
Part A
Method Name |
Type of value returned |
Parameters and (types) |
Description |
begin |
none |
none |
Method called at the start of the program to initialize the |
Method Name |
Type of value returned |
Parameters and (types) |
Description |
onMouseClick |
none |
point (Location) |
Method called when the mouse is clicked. It checks to see if the click occurred within a button, so appropriate actions can be performed. |
roll |
none |
none |
Randomly changes the die value to a new value between 1 and 6 |
getRoll |
int |
none |
Returns the current die value |
Part C
Method Name |
Type of value returned |
Parameters (and their types) |
Description |
onMousePress |
none |
point (Location) |
Method called when the mouse button is pressed. If the mouse button is pressed on a die, remember that it was selected (and its location) so that it can be dragged correctly. |
onMouseDrag |
none |
point (Location) |
Method called periodly as the mouse is being dragged. If a die was selected, move it to the new mouse location. |
onMouseRelease |
none |
point (Location) |
Method called when the mouse button is released. It "unsets" the flag (pressedOn instance variable) that indicates if the mouse was pressed. |