Aircraft wont turn

Thread Starter

nanobyte

Joined May 26, 2004
120
I am trying to make a program on Borland C++ Builder that will draw a aircraft(a simple concaved triangle with a line going through) and make the triangle be able to turn or spin 1 to 360 degrees(or negative angles). My problem is with making the aircraft turn. The function I'm using isn't working. I used this function to make a previous object( a circle with a line going through it to turn). So I figure that since the shape I'm using is different, I may need to changed the whole function. Check out the code and me what you think(it include the function to draw, erase, and turn the aircraft). I also have a attachment showing how I want the aircraft to be able to turn.



Rich (BB code):
//Draws Aircraft
void Aircraft::constructAircraft(void)
{
 Form1->Canvas->Pen->Color=clBlue;
 Form1->Canvas->Pen->Width=1;
 Form1->Canvas->MoveTo(x,y);
 Form1->Canvas->LineTo(x-size,y+size);  //left side
 Form1->Canvas->LineTo(x,y+(size/2)); //The base
 Form1->Canvas->LineTo(x+size,y+size);
 Form1->Canvas->LineTo(x,y);

 Form1->Canvas->Pen->Color=clBlack;
 Form1->Canvas->LineTo(x,y);
 Form1->Canvas->LineTo(x,y+(size/3));
}



//Erases Aircraft
void Aircraft::scrapAircraft(void)
{
 Form1->Canvas->Pen->Color=clBtnFace;
 Form1->Canvas->Pen->Width=1;
 Form1->Canvas->MoveTo(x,y);
 Form1->Canvas->LineTo(x-size,y+size);  //left side
 Form1->Canvas->LineTo(x,y+(size/2)); //The base
 Form1->Canvas->LineTo(x+size,y+size);
 Form1->Canvas->LineTo(x,y);

 Form1->Canvas->Pen->Color=clBtnFace;
 Form1->Canvas->LineTo(x,y);
 Form1->Canvas->LineTo(x,y+(size/3));
}


Rich (BB code):
//turns the aircraft
/*void Aircraft::turn(int t)
{
 for(int i=0; i<abs(t); i++)
 {
  scrapAircraft();
  if(t>0)
   angle+=1;
  else
   angle-=1;
 constructAircraft();
  Sleep(T);
 }

}*/
 

Brandon

Joined Dec 14, 2004
306
What is Form1, Canvas, Pen, Color, etc?

Are they defined classes or something from a header?

I've never done any form of drawing in C++ yet, I usually only deal with console apps.

Wouldn't mind trying to help and learning a little more at the same time.
 
Top