CONDICION if

Rafael
17 de Enero del 2006
como hago en este codigo para que cuando el valor de X aumente o dismuya, el valor de Y sea nulo, es para validar el movimiento de la torre del ajedrez

gracias

void __fastcall TForm1::TORN1MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if( capto == true )
{
TImage * theTORN1 = (TImage *) Sender;
int newX, newY;

if ( oldX < X )
{
newX = X - oldX;
theTORN1->Left = theTORN1->Left + newX;
inicio1 = true;
}
else if ( X < oldX )
{
newX = oldX - X;
theTORN1->Left = theTORN1->Left - newX;
inicio1 = true;
}

if ( oldY < Y )
{
newY = Y - oldY;
theTORN1->Top = theTORN1->Top + newY;
inicio2 = true;
}
else if ( Y < oldY )
{
newY = oldY - Y;
theTORN1->Top = theTORN1->Top - newY;
inicio2 = true;
}
if ((TORN1->Left - 3 < oldX || TORN1->Left +16 > oldX ) && (TORN1->Top - 3 < oldX || TORN1->Top +16 > oldX ))
{
diagonal = true;
}
/*
if ( capto == true )
{
if (TORN1->Top > Shape67->Top + 14 || TORN1->Top < Shape67->Top - 2)
if (TORN1->Left > Shape68->Left + 14 || TORN1->Left > Shape68->Left - 2)
{
diagonal = true;
}
else
if (TORN1->Top > Shape67->Top + 14 || TORN1->Top < Shape67->Top - 2)
if (TORN1->Left > Shape68->Left + 14 || TORN1->Left > Shape68->Left - 2)
{
diagonal = true;
}
else
diagonal = false;
}
*/
}
}
//---------------------------------------------------------------------------