Page 1 of 1

Stuck at Chessgame

Posted: Fri Aug 12, 2005 8:20 pm
by ColeZero
I'm creating a chess and 50% are done.
But now i have got some problems.
Has anyone a idea how to define the Fields??
I mean A1 to G8.
I have tried using emptySceneNode, but this doesn't work.
Then i tried using aabbboxes, to define a box A1 or something.
Has anyone a idea how to solve this problem?

So i can't check for position like this

Code: Select all


PiecePos = PiecePawn->getPosition();
A1 = vector3df(0,0,0);
if(PiecePos == A1)
{
a...
}
This isn't practicable.There must be another solution...

Posted: Sat Aug 13, 2005 3:09 am
by SARIN
set a list of structs. something like

Code: Select all

struct field {
vector3df pos;
bool occupied;
position2d<s32> coord;
bool ally;
}
array<field> fields;
use somthing like that for the field struct. then use this to retrieve stuff, and use position2d<s32> to store coordinates. then, when u have all 64 fields up, use the occupied to check if somehting is occupied, and if its an ally to move there.
to check position, add into ur peice pawn class or something an int position. use the position as a reference to the array of fields. use somthing like fields<peicepawn->position>.coord to get how far width and length it is.
[/code]

Posted: Sat Aug 13, 2005 11:56 am
by ColeZero
Big thx, now i know what to do, thanks