
-----------------------------------
Naveg
Sun Jan 23, 2005 11:30 am

checkers board layout
-----------------------------------
will this work ?? or am i gonna have to learn arrays to be able to move the pieces


setscreen ("graphics:320;320,nobuttonbar")

var boardx : int := 0
var boardy : int := 0

for row : 0 .. 7
    for column : 0 .. 7

        boardx := column * 40
        boardy := row * 40

        if (row rem 2 = 0 and column rem 2 = 0)
                or (row rem 2 = 1 and column rem 2 = 1) then
            drawfillbox (boardx, boardy, boardx + 40, boardy + 40, 91)

            if row = 0 or row = 1 or row = 2 then
                drawfilloval (boardx + 20, boardy + 20, 15, 15, 4)
            elsif row = 5 or row = 6 or row = 7 then
                drawfilloval (boardx + 20, boardy + 20, 15, 15, 2)
            end if

        else
            drawfillbox (boardx, boardy, boardx + 40, boardy + 40, 255)

        end if

    end for
end for

-----------------------------------
Neo
Sun Jan 23, 2005 11:39 am


-----------------------------------
Yes you'll need x and y coords for each piece, so an array is the way to go.

-----------------------------------
Naveg
Sun Jan 23, 2005 11:44 am


-----------------------------------
ok so i'm gonna need some help

-----------------------------------
Cervantes
Sun Jan 23, 2005 11:52 am


-----------------------------------
Check out an [url=http://www.compsci.ca/v2/viewtopic.php?t=366]array tutorial or [url=http://www.compsci.ca/v2/viewtopic.php?t=1117]two.

-----------------------------------
MysticVegeta
Sun Jan 23, 2005 12:41 pm


-----------------------------------
Check out an 
As cervantes mentioned check out the second link he posted. 2d arryas are great for makiong a layout of a checkerboard!!!!

-----------------------------------
person
Tue Jan 25, 2005 5:29 pm


-----------------------------------
u can learn arrays but if u really dont get it, u can just use lots of variables. but seriously.. arrays will save u a ton of time, so use arrays!  :D  :D  :D

-----------------------------------
Naveg
Tue Jan 25, 2005 6:33 pm


-----------------------------------
ok let me rephrase my question. The board and pieces are drawn using for loops and if statements. It works. The question is, will it be possible to have the pieces move and stuff with the setup like this, or are arrays a MUST?

-----------------------------------
cycro1234
Tue Jan 25, 2005 7:40 pm


-----------------------------------
Well, u might have to use arrays when checking for things such as jumping over an enemy, or kinging someone. To move the pieces, u cud try using the mouse command "mouswhere" and have the pice follow the mouse. But then u'd have to make boundries so the user can't put the pieces anywhere he/she wants....

I love checkers! Good luck wit it, nd if its not a final project or sometin, PM me nd i'll help as best as i can.

-----------------------------------
person
Tue Jan 25, 2005 8:18 pm


-----------------------------------
now, if u dont like arrays for some odd reason, or u dont like mousewhere, u can always select a piece, and then using the arrow key to move it

-----------------------------------
person
Tue Jan 25, 2005 8:20 pm


-----------------------------------
btw, y dont u want to use arrays

-----------------------------------
Naveg
Tue Jan 25, 2005 8:39 pm


-----------------------------------
cause i dont know how to use em to draw a board, and how to apply them to identify each piece....the tutorials didnt help me so much

-----------------------------------
basketball4ever
Wed Jan 26, 2005 1:10 am


-----------------------------------
it IS possible, but your looking at around 1000-2000 lines just from the board, and not even the processing of each card (money/go to jail)

you just have to set a coordinate as position for each player... so that the position = position + dice roll

then u just set the coordinates for each position for example: (there should be 36 different positions for monopoly i believe) so position 1 (start) would be like (0,500) then position 2 (50,500) and so on... 

strongly dont recomend it cos it takes alot of lines and trouble... but meh if you want it this way  :roll:  its easier with arrays definetly :P

-----------------------------------
Trojan Man
Wed Jan 26, 2005 3:28 am


-----------------------------------
You'll be able to move the pieces without using arrays without much problem, but then when it comes to the rules of the game, that's gonna be a pain in the ass.

it IS possible, but your looking at around 1000-2000 lines just from the board, and not even the processing of each card (money/go to jail) 

you just have to set a coordinate as position for each player... so that the position = position + dice roll 

then u just set the coordinates for each position for example: (there should be 36 different positions for monopoly i believe) so position 1 (start) would be like (0,500) then position 2 (50,500) and so on... 

strongly dont recomend it cos it takes alot of lines and trouble... but meh if you want it this way  its easier with arrays definetly

Umm, not to be mean or anything, but I think this topic is about checkers, not monopoly...

-----------------------------------
basketball4ever
Wed Jan 26, 2005 2:06 pm


-----------------------------------
You'll be able to move the pieces without using arrays without much problem, but then when it comes to the rules of the game, that's gonna be a pain in the ass.

it IS possible, but your looking at around 1000-2000 lines just from the board, and not even the processing of each card (money/go to jail) 

you just have to set a coordinate as position for each player... so that the position = position + dice roll 

then u just set the coordinates for each position for example: (there should be 36 different positions for monopoly i believe) so position 1 (start) would be like (0,500) then position 2 (50,500) and so on... 

strongly dont recomend it cos it takes alot of lines and trouble... but meh if you want it this way  its easier with arrays definetly

Umm, not to be mean or anything, but I think this topic is about checkers, not monopoly...

for example
:) make him think for himself :)

-----------------------------------
cycro1234
Wed Jan 26, 2005 3:43 pm


-----------------------------------
Just as used 2 for loops to create the gameboard, you can use an array to create empty variables for each space. That is, assign each variable a value of "0" if there is no piece, "1" if theres a player 1 piece, and "2" if there's a player 2 piece. Then, u can check to see position of the pieces using if statements.

-----------------------------------
person
Wed Jan 26, 2005 6:40 pm


-----------------------------------
wouldnt true/false be better than 1,2,3 since then, u can use buttons for turns
