Computer Science Canada Help, MineSweeper!! |
Author: | B-Man 31 [ Tue Mar 31, 2009 10:11 pm ] | ||
Post subject: | Help, MineSweeper!! | ||
Im trying to make a minesweeper game for fun. but im having trouble getting the selected square to dissapear, any help will be appreciated. this is still in its very early stages.
[/syntax] |
Author: | Tony [ Tue Mar 31, 2009 10:31 pm ] |
Post subject: | RE:Help, MineSweeper!! |
well your reveal procedure has no way of knowing what button the call came from. That sounds like a problem. Are you sure that the GUI module is the best way to implement this? |
Author: | B-Man 31 [ Tue Mar 31, 2009 10:36 pm ] |
Post subject: | Re: Help, MineSweeper!! |
No, i just thought it be easy is there any way of keeping it with the Gui, thx |
Author: | Tony [ Wed Apr 01, 2009 1:32 am ] | ||
Post subject: | RE:Help, MineSweeper!! | ||
you'd have to read the documentation, to understand how the GUI module works. What it offers, and its limitations. Also, what's up with this for loop?
|
Author: | B-Man 31 [ Wed Apr 01, 2009 3:38 pm ] |
Post subject: | Re: Help, MineSweeper!! |
thats for 99 mines, it gives it a random X and y value for the placing |
Author: | Tony [ Wed Apr 01, 2009 3:51 pm ] | ||
Post subject: | RE:Help, MineSweeper!! | ||
don't you think that having
would have the same net result? |
Author: | B-Man 31 [ Wed Apr 01, 2009 3:53 pm ] |
Post subject: | Re: Help, MineSweeper!! |
no, cuz i need 99 mines |
Author: | Tony [ Wed Apr 01, 2009 3:55 pm ] |
Post subject: | RE:Help, MineSweeper!! |
but you are changing the same mx variable 99 times. |
Author: | B-Man 31 [ Wed Apr 01, 2009 3:56 pm ] | ||
Post subject: | Re: Help, MineSweeper!! | ||
right, i nevr realized that thks, i might make a type for the mines and boxes. that would help a lot i think. this si just the first time im actually using multi dimensional arrays, but, if i make a array of say
can i turn those into multi dimensional arrays? |
Author: | Tony [ Wed Apr 01, 2009 4:10 pm ] |
Post subject: | RE:Help, MineSweeper!! |
you could have arrays of type, yes. (perhaps not flexible arrays... those have certain limitations). Don't you think that the box should know if it has a mine inside of it? |
Author: | B-Man 31 [ Wed Apr 01, 2009 4:12 pm ] |
Post subject: | RE:Help, MineSweeper!! |
yeah, that will come,im mainly concerned about making the right box dissapear right now, i only started this yesterday and i will continue |
Author: | corriep [ Wed Apr 01, 2009 5:52 pm ] | ||
Post subject: | Re: Help, MineSweeper!! | ||
Tony wrote: you could have arrays of type, yes. (perhaps not flexible arrays... those have certain limitations).
|
Author: | Tony [ Wed Apr 01, 2009 5:55 pm ] |
Post subject: | RE:Help, MineSweeper!! |
Oh, wait... you could have a flexible array of type, but you can't have type with a flexible array inside. Thx corriep. |
Author: | saltpro15 [ Wed Apr 01, 2009 5:58 pm ] | ||
Post subject: | RE:Help, MineSweeper!! | ||
corriep, I think what Tony means is
I think you guys are going a little bit off topic with this though :p |
Author: | B-Man 31 [ Wed Apr 01, 2009 8:53 pm ] | ||
Post subject: | Re: Help, MineSweeper!! | ||
i know about flexible arrays pretty well, i did some adjustments but the error that i get now I dont gat, if someone could explain this to me, that would be appreciated. This is it now:
|
Author: | Dusk Eagle [ Wed Apr 01, 2009 10:04 pm ] |
Post subject: | Re: Help, MineSweeper!! |
Error #1: "Argument is the wrong type". This error is caused because you are trying to pass a procedure (which by definition cannot represent a value) as a value to the CreateButtonFull procedure. You must first change the procedure to a function so that it returns a value, then you must pass an actual parameter to the "reveal" procedure, as it requires one. If you don't know what I'm talking about, I suggest you read the following tutorial on functions and procedures: Functions and Procedures. Once you've corrected your current errors, you may have more errors before your program will run, but that's for you to solve. BTW - global variables are generally not a recommended programming practice - use parameters instead. Visit the link above to learn more. Error #2: "Missing parameters in call to drawBox". Again, see the link above for help in solving this problem. |
Author: | Tony [ Wed Apr 01, 2009 10:40 pm ] |
Post subject: | Re: Help, MineSweeper!! |
Dusk Eagle @ Wed Apr 01, 2009 10:04 pm wrote: Error #1: "Argument is the wrong type".
This error is caused because you are trying to pass a procedure (which by definition cannot represent a value) as a value to the CreateButtonFull procedure. You must first change the procedure to a function so that it returns a value... He's not passing the result of a procedure, but a reference to procedure itself. Which is a legal type, and exactly what the GUI module expects. The problem is that his procedure definition expects an argument. Which is not there. The GUI module was not build for calling procedures with arguments; although it might be possible to modify the framework to allow for that. |