Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Dragula
23
Years of Service
User Offline
Joined: 11th May 2003
Location:
Posted: 8th Jun 2003 22:24
i am attempting to make a checkers games using a matrix. if i were to click on an empty square in the matrix how could I save the corrdinates of that square into a value? So say i click on a checker then click on an empty square and the checker moves into that square.
I am using dbpro. I'm sure there are other ways to go about making a checkers game but i'm using this project to learn more about matrix's. I have also tried matedit. But i would like to understand everything thats going on behind the scenes before i use a program to do it for me.
simonuk74
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location:
Posted: 9th Jun 2003 00:00
ok, I have some code somewhere, similar to what you want to do, but I cant find it right now, so I`ll try to lead you through the basics.
I¬ dont know how much you know about DBpro coding, if you not sure ask, but I`ll also try to find a snippet for you.

ok here are the basics ( ish )

create an matrix, the size of the checker board, and create an array the same size.

make matrix 1,80,80,8,8 - will make a matrix 8X8, with a grid size of 10 ( 80/8 )

dim C_board(8,8) - the board size

then, when you click on the checker, ( let different checkers have different values ), set a `current selection` value to that of the checker.

then when you click on the matrix, use some math to figure out where the mouse is on the matrix to get the X & Z values of the selected position on the board, then put in the array :

c_board(position X,position Z)=current checker value

and also, place an object on the matrix, at the location, to represent the checker, or you could texture that particular matrix tile.

I hope this has helped.
if not, let me know!

Login to post a reply

Server time is: 2026-07-11 11:42:46
Your offset time is: 2026-07-11 11:42:46