Created
October 10, 2012 02:06
-
-
Save ChrisLundquist/3862736 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Dice { | |
public: | |
Dice(); | |
void roll(); | |
int get_value(); | |
string to_string(); | |
IMAGE get_image(); | |
private: | |
int value; | |
IMAGE image1; | |
IMAGE image2; | |
// ... | |
// constructor | |
Dice() { | |
value = 1; | |
image1 = Image.FromFile(filepath + "die-1.gif"); | |
image2 = Image.FromFile(filepath + "die-2.gif"); | |
// ... | |
} | |
void roll() { | |
value = Random(6) + 1; | |
} | |
int get_value() { | |
return value; | |
} | |
IMAGE get_image() { | |
if(value == 1) { | |
return image1; | |
} else if (value == 2) { | |
return image2; | |
} | |
// ... | |
else { | |
return image6; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment