Creating Moving Cycle in Computer Graphics


Creating Moving Cycle in Computer Graphics


#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,“..//BGI");
for(int x=0;x<750;x++)
{
cleardevice();

//ROAD
line(10,401,700,401);  //creating road



//WHEELS
circle(40+x,370,30); //back wheel, addition of x on x-axis to move circle on x-axis
circle(150+x,370,30); //front wheel, addition of x on x-axis to move circle on x-axis

line(40+x,370,100+x,370); // back wheel horizontal line
line(40+x,370,60+x,340);  // left line on back wheel of cycle
line(100+x,370,120+x,340); //right line on back wheel of cycle
line(120+x,340,60+x,340); //center upper line to join left and right line
line(60+x,340,60+x,335); //seat vertical line
line(55+x,335,65+x,335); //seat vertical line
line(150+x,370,100+x,320); //line from front wheel
line(100+x,320,90+x,320); //handle
delay(10);
}
getch();
closegraph();
}


Download/view your lecture slide (Audio+ Video)

Comments