Ver Mensaje Individual
  #5  
Antiguo 27-03-2013
cloayza cloayza is offline
Miembro
 
Registrado: may 2003
Ubicación: San Pedro de la Paz, Chile
Posts: 922
Reputación: 23
cloayza Tiene un aura espectacularcloayza Tiene un aura espectacular
Amigo te propongo esta modificación a tu algoritmo...

Código Delphi [-]
{
APos[Tag].X  =>Indice de la matriz
APos[Tag].Y  =>Indice de la matriz

Tag  Posicion Matriz
--------------------
1  =>matriz [1,1]
2  =>matriz [1,2]
3  =>matriz [1,3]
4  =>matriz [2,1]
5  =>matriz [2,2]
6  =>matriz [2,3]
7  =>matriz [3,1]
8  =>matriz [3,2]
9  =>matriz [3,3]

matriz [ APos[Tag].X, APos[Tag].Y ]
}

Const
    APos:Array[1..9] Of TPoint=((X:1; Y:1),(X:1;Y:2),(X:1;Y:3),(X:2;Y:1),(X:2;Y:2),(X:2;Y:3),(X:3;Y:1),(X:3;Y:2),(X:3;Y:3));
    {APos Vector con las coordenadas de x e y de la matriz...}

var i, aux:Integer;
    matriz:array[1..3,1..3] of Integer;
begin
   aux:= aux+1;

   if (aux mod 2 <> 0) then
     begin
       (sender as timage).picture:= form2.image1.Picture;
       (sender as timage).enabled:= false;

       Matriz[ APos[Tag].X, APos[Tag].Y]:= 1;

{       if tag = 1 then
         matriz[1,1]:= 1
       else
         if tag = 1  then
           matriz[1,2]:=1
         else
           if tag =3 then
             matriz[1,3]:=1
           else
             if tag = 4 then
               matriz[2,1]:=1
             else
               if tag = 5 then
                 matriz[2,2]:=1
               else
                 if tag = 6 then
                   matriz[2,3]:=1
                 else
                   if tag = 7 then
                     matriz[3,1]:= 1
                   else
                     if tag = 8 then
                       matriz[3,2]:=1
                     else
                       matriz[3,3]:=1;
}
       for i:=8 to  248 do
         begin
           sleep(1);
           refresh;
           shape1.top:=i;
         end;
     end
   else
     begin
       (sender as timage).picture:= form2.image2.Picture;
       (sender as timage).enabled:= false;

       Matriz[ APos[Tag].X, APos[Tag].Y]:= 1;

       {if tag = 1 then
         showmessage('Hola')
       else
         if tag = 2 then
           matriz[1,2]:=2
         else
           if tag =3 then
             matriz[1,3]:=2
           else
             if tag = 4 then
               matriz[2,1]:=2
             else
               if tag = 5 then
                 matriz[2,2]:=2
               else
                 if tag = 6 then
                   matriz[2,3]:=2
                 else
                   if tag = 7 then
                     matriz[3,1]:= 2
                   else
                     if tag = 8 then
                       matriz[3,2]:=2
                     else
                       matriz[3,3]:=2;
       }
       for i := 248 downto 8 do
         begin
           sleep(1);
           refresh;
           shape1.Top:=i;
         end;
     end;

Saludos cordiales
Responder Con Cita