Aircraft wont turn

Discussion in 'Programmer's Corner' started by nanobyte, Mar 31, 2005.

  1. nanobyte

    Thread Starter Senior Member

    May 26, 2004
    118
    1
    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.



    Code ( (Unknown Language)):
    1. //Draws Aircraft
    2. void Aircraft::constructAircraft(void)
    3. {
    4.  Form1->Canvas->Pen->Color=clBlue;
    5.  Form1->Canvas->Pen->Width=1;
    6.  Form1->Canvas->MoveTo(x,y);
    7.  Form1->Canvas->LineTo(x-size,y+size);  //left side
    8.  Form1->Canvas->LineTo(x,y+(size/2)); //The base
    9.  Form1->Canvas->LineTo(x+size,y+size);
    10.  Form1->Canvas->LineTo(x,y);
    11.  
    12.  Form1->Canvas->Pen->Color=clBlack;
    13.  Form1->Canvas->LineTo(x,y);
    14.  Form1->Canvas->LineTo(x,y+(size/3));
    15. }
    16.  
    17.  
    18.  
    19. //Erases Aircraft
    20. void Aircraft::scrapAircraft(void)
    21. {
    22.  Form1->Canvas->Pen->Color=clBtnFace;
    23.  Form1->Canvas->Pen->Width=1;
    24.  Form1->Canvas->MoveTo(x,y);
    25.  Form1->Canvas->LineTo(x-size,y+size);  //left side
    26.  Form1->Canvas->LineTo(x,y+(size/2)); //The base
    27.  Form1->Canvas->LineTo(x+size,y+size);
    28.  Form1->Canvas->LineTo(x,y);
    29.  
    30.  Form1->Canvas->Pen->Color=clBtnFace;
    31.  Form1->Canvas->LineTo(x,y);
    32.  Form1->Canvas->LineTo(x,y+(size/3));
    33. }


    Code ( (Unknown Language)):
    1. //turns the aircraft
    2. /*void Aircraft::turn(int t)
    3. {
    4.  for(int i=0; i<abs(t); i++)
    5.  {
    6.   scrapAircraft();
    7.   if(t>0)
    8.    angle+=1;
    9.   else
    10.    angle-=1;
    11.  constructAircraft();
    12.   Sleep(T);
    13.  }
    14.  
    15. }*/
     
  2. Brandon

    Senior Member

    Dec 14, 2004
    306
    0
    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.
     
Loading...