Stuck at Chessgame

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
ColeZero
Posts: 20
Joined: Wed Jul 27, 2005 2:33 pm

Stuck at Chessgame

Post 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...
SARIN
Posts: 139
Joined: Fri Oct 29, 2004 3:53 am

Post 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]
ColeZero
Posts: 20
Joined: Wed Jul 27, 2005 2:33 pm

Post by ColeZero »

Big thx, now i know what to do, thanks
Post Reply