Ver Mensaje Individual
  #6  
Antiguo 27-10-2016
Snaked Snaked is offline
Baneado
NULL
 
Registrado: sep 2016
Posts: 102
Reputación: 0
Snaked Va por buen camino
Ecfisa: ya lo he solucionado.... he adaptado tu funcion al TTimer de la siguiente manera

1) declaro como globales las siguientes variables

Código PHP:
TPoint INICIO_NAVE;
TPoint DESTINO_NAVE;
bool STOP_MOVIMIENTO_NAVE = false;
int x = 0; int y = 0;
int dx = 0;
int dy = 0; 
y luego en el TTimer tengo puesto esto

Código PHP:
  if(x < DESTINO_NAVE.x) { x++; y = INICIO_NAVE.y + dy * (x - INICIO_NAVE.x) / dx; }
  else 
STOP_MOVIMIENTO_NAVE = true; 
de forma que cada vez que se produce un tick del timer avanza por la linea

y luego en el dibujado del mapa en pantalla tengo asi

Código PHP:
 void Muestra_Mapa(void)
{

   
SECTOR_VEGA();

   
//Dibuja la nave 1
      
Form1->g2 = 0;
      
Form1->g2 = Form2->Image_explorer1->Picture->Graphic;
      
Form1->tablero->Canvas->Draw(x, y,  Form1->g2);

    if(
rejilla) Muestra_Rejilla();


 
Form1->tablero->Repaint();
 
Form1->skreen->Picture->Graphic = Form1->tablero->Picture->Graphic;
 
Application->ProcessMessages();

} 

y para comenzar el proceso de animacion, esto en un TButton (enviar nave de exploracion)

Código PHP:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
 
pos_nave1X = 40 + Form2->Image2->Picture->Graphic->Width-80;
 
pos_nave1Y = 40 + Form2->Image2->Picture->Graphic->Height;
 
INICIO_NAVE = Point( 40 + Form2->Image2->Picture->Graphic->Width/2, 40 + Form2->Image2->Picture->Graphic->Width/2);
 
DESTINO_NAVE = Point( 240, 410);

  
dx = DESTINO_NAVE.x - INICIO_NAVE.x;
  
dy = DESTINO_NAVE.y - INICIO_NAVE.y;
  
x = INICIO_NAVE.x;
}
//--------------------------------------------------------------------------- 
Responder Con Cita