How To Draw a Moving Car After Process Bar Animation in C++ (Computer Graphics)
PROJECT BY (SIMPLIFY LEARN PROGRAMMING)
ON
MOVING CAR AFTER PROCESS BAR ANIMATION
SOURCE CODE:
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
clrscr();
int i,m,gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TC\\BGI");
outtextxy(140,80,"Please wait ...");
for(m=100;m<500;m++)
{
line(m,100,m,130);
delay(50);
}
if(m==500)
{
for(i=0;i<=500;i++)
{
settextstyle(1,HORIZ_DIR,2);
outtextxy(110,150,"Welcome To Moving Car Animation");
/***CAR BODY ******/
setcolor(WHITE);
setfillstyle(SOLID_FILL,4);
line(0+i,300,13+i,298);
line(13+i,298,30+i,280);
line(30+i,280,80+i,280);
line(80+i,280,97+i,298);
line(97+i,298,120+i,300);
line(0+i,300,0+i,315);
line(0+i,315,25+i,315);
arc(35+i,315,0,180,9);
line(45+i,315,67+i,315);
arc(77+i,315,0,180,9);
line(85+i,315,120+i,315);
line(120+i,300,120+i,315);
floodfill(1+i,301,WHITE);
/***CAR Windows***/
setcolor(WHITE);
setfillstyle(SOLID_FILL,BLACK);
line(32+i,285,50+i,285);
line(50+i,285,50+i,295);
line(50+i,295,23+i,295);
line(32+i,285,23+i,295);
floodfill(33+i,286,WHITE);
setcolor(WHITE);
setfillstyle(SOLID_FILL,BLACK);
line(60+i,285,78+i,285);
line(60+i,285,60+i,295);
line(60+i,295,85+i,295);
line(78+i,285,85+i,295);
floodfill(61+i,286,WHITE);
setcolor(WHITE);
setfillstyle(SOLID_FILL,DARKGRAY);
circle(35+i,315,6);
floodfill(36+i,314,WHITE);
//RIGHT WHEELS
setcolor(WHITE);
setfillstyle(SOLID_FILL,DARKGRAY);
circle(77+i,315,6);
floodfill(76+i,314,WHITE);
delay(25);
cleardevice();
setcolor(WHITE);
line(0,322,700,322);
}
}
closegraph();
getch();
}
OUTPUT:
Comments
Post a Comment