i am about to make a game where a plane is moving on x axis and the cannon use to hit the plan with cannon ball and the plane has to crash i did all what i can but i got a serious problem problem 1: when plan is moving i can't use canon cause both are using for loop and they have to wait for each other to finish problem 2: because of cleardevice(); function its so difficult for me to continue both movement of the cannon ball and plan anybody having any idea what i am missing would be appreciated its very important thanks in advance
#include <graphics.h>
#include <windows.h>
void fire();
void canon();
void plan();
void plan_move();
int main( )
{
initwindow(800, 500, "First Sample");
canon();
 plan_move();
 plan();
getch();
return 0;
}
void fire()
{
 int i=0;
 for(i=0;i<370;i++)
 {
         circle(363, 400-i, 13);
         setcolor(WHITE);
         delay(5);
         canon(); 
         cleardevice();
         }
  }
void canon()
{
 line(350,450,350,400);
 line(380,450,380,400);
 circle(365,400,15);
 circle(365,470,25);
  }
void plan()
{
line(25,70,50,70);
line(25,30,50,30);
line(80,70,50,30);
line(80,70,50,70);
line(25,30,25,70);
} 
void plan_move()
{
   int i=0;
   for(i=0;i<700;i++)
   {
     line(25+i,70,50+i,70);
     line(25+i,30,50+i,30);
     line(80+i,70,50+i,30);
     line(80+i,70,50+i,70);
     line(25+i,30,25+i,70);
     delay(8);
     canon();
        if(GetAsyncKeyState(VK_SPACE))
         {
         fire();
         } 
           cleardevice();
          }
            } 
 
     
     
    