Computer Science Canada Need help with project |
Author: | Regals [ Fri Jun 06, 2008 11:08 am ] | ||
Post subject: | Need help with project | ||
Hello everyone. I'm creaing a dice game for a project in my ICS class. The premise of the game is that a player enters a bet amount and win's 2x the bet amount if the roll is a 6. However, I also want to have a GUI window open with the picture of the amount of the roll (i.e. a roll of 5 shows the image of a die rolling a 5). Here is my code so far:
Any ideas on how I can get the program to show the correct pictures? |
Author: | btiffin [ Fri Jun 06, 2008 11:47 am ] |
Post subject: | RE:Need help with project |
http://www.leepoint.net/notes-java/examples/graphics/rolldice/rolldice.html For one example. Cheers |
Author: | Regals [ Fri Jun 06, 2008 12:40 pm ] |
Post subject: | Re: Need help with project |
I'm not understanding exactly how that program works. Can someone explain it for me. Thanks. |
Author: | btiffin [ Fri Jun 06, 2008 1:19 pm ] |
Post subject: | Re: Need help with project |
For your needs; ignore the applet JFrame (RollDice.java) and the JPanel extension (RollDicePanel.java) and hone in on the last source listing (Die.java). It should give you enough hints about one way of drawing a die in a window. In particular the paintComponents method and how it draws the pips on the white background. (drawSpot and its usage of fillOval). Cheers |
Author: | Regals [ Mon Jun 09, 2008 1:00 pm ] | ||
Post subject: | Re: Need help with project | ||
Alright, so I have the dice being drawn to the screen. However, I now have a problem with the betting algorithm. I cant figure out what it's doing. Here is the code:
Any input on how to fix this is appreciated. Thank you for your time. -Regals |
Author: | Regals [ Wed Jun 11, 2008 10:50 am ] |
Post subject: | Re: Need help with project |
bump |