Computer Science Canada dice that do not roll |
Author: | JustTrying2GetBy [ Thu Jan 13, 2005 2:41 pm ] | ||
Post subject: | dice that do not roll | ||
=( i have two dice for my program, but only one of them shows a number. can sumone find the error in my code, or the fix to it?
|
Author: | Mazer [ Thu Jan 13, 2005 2:55 pm ] | ||
Post subject: | |||
You are missing alot of code and details that would help us figure out what's wrong. First, you haven't givent us many of the variable declarations so we can't run the program properly to see exactly what your problem is. Second, it looks to me like you are trying to draw things at coordinates that wouldn't show up on the screen. But I have not idea how big the window is, so maybe that's not your problem. Here's my understanding of the code you've provided: (for die1) loop if some obscure area of the screen is clicked get a random number from 1 to 6 and draw the appropriate dice increase counter (whatever the hell that is) by 1 if counter is equal to 1 (let's hope it started as 0) exit this loop end loop die2 seems to be exactly the same except for the following differences: -It checks for a mouse click in a different area of the screen -It draws the dice in another area of the screen -It uses a one sided dice (but has the capability to draw any of 6 possible sides) So, after that long post I guess this could be the problem you're having (in die2):
![]() |
Author: | JustTrying2GetBy [ Thu Jan 13, 2005 3:01 pm ] | ||||
Post subject: | |||||
I was trying to find out what was the error, thats why i had
As for screen size, i changed it y going prefs. I used 55 rows, and 100 colums. The full code with variables...
The probelm is the 2nd die, which does not display any of the red dots it is soupposed to. Even if the randint were set to chose between 1 and 1, it will still display the one red dot, but my 2nd die dosent seem to display anything at all =/ |
Author: | Cervantes [ Thu Jan 13, 2005 5:26 pm ] | ||
Post subject: | |||
Are you sure that the coordinates for drawing the second die are in fact viewable? They seem to be very, very large. Try running this:
If the value that that outputs is less than 1051, you'll be missing some stuff. |