Non ça ne pose pas de problème si tu les mets dans les deux.
Tu es sûr que tu n'en avais pas enlevée une de trop ?
attributes
Compartment: Integer; //--------------------------n° de case où se trouve le joueur
CompartmentForMove: Integer; //----------------cases incrémentées par la varaible I (pour l'animation)
SquareExe: Boolean; //----------------------------si True, effet sur la case executé
procedure CompartmentDestination(Player: TPlayer);
var
Dest: TQualifiedPos;
begin
Dest.Map := Player.Master.Map['GameBoardMap'];
case Player.CompartmentForMove of
0: Dest.Position := Point3D(01, 15, 1);
1: Dest.Position := Point3D(01, 19, 1);
//--------------------------------------------etc...
63: Dest.Position := Point3D(16, 10, 1);
end;
if Player.SquareExe = True then
Player.MoveTo(Dest,true)
else
Player.MoveTo(Dest,false);
end;
effect TDices
//---------------blabla etc, tirage de 2 dés donne "DicesResult"
I := Player.Compartment + 1; //--------pour commencer l'animation à la case suivante
Player.Compartment := Player.Compartment + DicesResult; //-----prochaine case à atteindre
if Player.Compartment > 63 then //---------là je pense que cette condition n'est pas placée au bon endroit !.
Player.Compartment := 126 - Player.Compartment; //------si le joueur dépasse la case n°63, il retourne en arrière
Player.SquareExe := False;
while I < Player.Compartment do //--------début de l'animation
begin
Player.CompartmentForMove := I; //---le joueur va donc "survoler" les cases une à une
CompartmentDestination(Player);
Sleep(300);
Inc(I);
end; //---------------------------------------fin de l'animation lorsque le n° de case sera le n° de destination - 1
Player.CompartmentForMove := Player.Compartment; //----n° de case "survolée" = n° de case de destination
Player.SquareExe := True; //---cette fois-ci l'effet de la case sera executé
CompartmentDestination(Player);
while I < Player.Compartment do
begin
Player.CompartmentForMove := I;
CompartmentDestination(Player);
if VirtualCompartment > 63 then //-----(var VirtualCompartment := Player.Compartment;)
begin
VirtualCompartment := 126 - Player.Compartment;
Sleep(300);
Inc(I,-1); //--------------c'est possible ça !??
end else
begin
Sleep(300);
Inc(I);
end;
function ComputeNextCompartment(Current, DicesResult: Integer): Integer;
begin
Result := Current + DicesResult;
if Result > 63 then
Result := (2*63) - Result;
end;
var
Origin, I: Integer;
Player.SquareExe := False;
I := 1;
while I < DicesResult do
begin
Player.CompartmentForMove := ComputeNextCompartment(Player.Compartment, I);
CompartmentDestination(Player);
Sleep(300);
Inc(I);
end;
Player.CompartmentForMove := ComputeNextCompartment(Player.Compartment, I);
Player.Compartment := Player.CompartmentForMove;
Player.SquareExe := True;
CompartmentDestination(Player);
// Pas la ligne "I := 1;"
for I := 1 to DicesResult-1 do
begin
Player.CompartmentForMove := ComputeNextCompartment(Player.Compartment, I);
CompartmentDestination(Player);
Sleep(300);
end;