Animating a Truck in C

#include <graphics.h>
#include <dos.h>
#include <conio.h>

void main()
{
   int i, gd = DETECT, gm;
   initgraph(&gd,&gm,"C:\\TC\\BGI");
   setviewport(0,0,639,440,1);

   for( i = 0 ; i <= 420 ; i = i + 10)
   {
      rectangle(50+i,275,150+i,400);
      rectangle(150+i,350,200+i,400);
      circle(75+i,410,10);
      circle(175+i,410,10);
      delay(50);
      clearviewport();
   }

   getch();
   closegraph();
}

Output

 

Output 1

 

Output 2

 

Output 3

 

Leave a Reply

Your email address will not be published. Required fields are marked *