Computer Science Canada Grid |
Author: | awesomej01 [ Sun Mar 07, 2004 12:28 am ] |
Post subject: | Grid |
I have a minor project assigned to me and it happens to be a dice game. I plan to make a snakes and ladders program. The only thing that is stopping me is how to start. Do I plan out how many boxes I want in my grid first, then draw it as a background and then make a two dimensional array? ![]() |
Author: | zylum [ Sun Mar 07, 2004 12:39 am ] | ||
Post subject: | |||
something like this?
what exactly do you need help with? basically in the above example, i declare the constants of the grid, create an array which reflects these constants (ie size) and then i draw a random grid... rather than assigning a value between 1 and 0 and draw a black/white box, you could assign any number of values for each type of tile you want ie snake, ladder, lose a turn etc. then when the player lands on a square you check what type it is and make the appropiate actions happen. -zylum |
Author: | awesomej01 [ Sun Mar 07, 2004 11:42 am ] |
Post subject: | Grid |
Okay from the grid that you posted, say I want to do something like when you click on the top right box of the grid, the program would say, "Lose a turn." How would I do that? |
Author: | Paul [ Sun Mar 07, 2004 11:49 am ] | ||
Post subject: | |||
Use mouse.where for clicking, ex:
|
Author: | Cervantes [ Sun Mar 07, 2004 1:27 pm ] |
Post subject: | |
its kinda confusing Paul when you have z as a variable... that makes us think 3d. z should really be renamed "button" or "btn". anyways, if you want it to be a customizeable grid, you should incorporate your x and y values from the 2d array in that if statement. Or you could just use whatdotcolour ![]() |
Author: | awesomej01 [ Sun Mar 07, 2004 7:55 pm ] |
Post subject: | Grid |
Since I am making a dice game and you guys showed me how to draw a grid and locate a position of the grid, how do I do something like if the player rolled a 2, then their marker would move two spaces. would it be something like if roll = 2 then drawfilloval (on the second box location) elsif roll=3 then elsif... ... for every other possiblities end if |
Author: | Cervantes [ Sun Mar 07, 2004 8:04 pm ] | ||||
Post subject: | |||||
you should have a variable for the player's spot. then it would be
draw where he is on the grid by using mod and div to determine the grid location. if he were at 10 and the grid is 7 wide..
I haven't tested any of this code, just so you know. |
Author: | omni [ Sun Mar 07, 2004 9:21 pm ] |
Post subject: | |
you took my idea for a dice game you go to massey and in mr.ferrara right? |
Author: | jonos [ Sun Mar 07, 2004 9:23 pm ] |
Post subject: | |
i shouldn't answer for cervantes, but he doesn't go to massey (im pretty sure), i know this because, you see, i stalk him ![]() |
Author: | Mazer [ Sun Mar 07, 2004 9:43 pm ] |
Post subject: | |
jonos wrote: i shouldn't answer for cervantes, but he doesn't go to massey (im pretty sure), i know this because, you see, i stalk him
![]() (He may have been talking to awesomej01) |
Author: | McKenzie [ Mon Mar 08, 2004 11:45 am ] |
Post subject: | |
Stop by my room at lunch. There are easy and hard ways to do your program. The biggest problem is that the game is no fun. As a kid the fun part is rolling the dice. On the computer all you do is hold down the enter key and see who wins (no choices at any point, just roll, read then obey) |