早期写的,没加注释,当时自我得意了一番,^_^!
#include<graphics.h>
void bike();
main()
{
int i,graphdrive=DETECT,graphmode;
registerbgidriver(EGAVGA_driver);
registerbgifont(TRIPLEX_FONT);
initgraph(&graphdrive,&graphmode,"f://tc");
for(i=0;i<=519;i+=1)
{
setviewport(519-i,120,639-i,360,0);
bike(60,120,i);
clearviewport();
}
}
void bike(int midx,int midy,int i)
{
int y,dx,dy,x1,x2,y1,y2;
setbkcolor(LIGHTGREEN);
setfillstyle(0,LIGHTGREEN);
setcolor(RED);
y=i%30;
setlinestyle(0,0,1);
circle(midx,midy,5);
circle(midx-35,midy,22);
circle(midx+35,midy,22);
circle(midx+35,midy,3);
pieslice(midx,midy,0,360,1);
line(midx+1,midy+5,midx+35,midy+3);
line(midx+1,midy-5,midx+35,midy-3);
pieslice(midx-35,midy,i,i+60,22);
pieslice(midx-35,midy,i+120,i+180,22);
pieslice(midx-35,midy,i+240,i+300,22);
pieslice(midx+35,midy,i,i+60,22);
pieslice(midx+35,midy,i+120,i+180,22);
pieslice(midx+35,midy,i+240,i+300,22);
x1=midx-30;
y1=midy-32;
x2=midx+20;
y2=midy-30;
moveto(x2,y2);
linerel(0,-3);
moveto(x2,y2);
linerel(30,0);
moveto(x2+30,y2);
lineto(midx+35,midy);
moveto(x2+10,y2);
lineto(midx+35,midy);
setcolor(BLUE);
line(x2,y2-7,x2,y2-44);
circle(x2,y2-52,8);
if(y<15)
{
line(x2,y2-7,midx-5,midy-25);
line(x2,y2-7,midx+5,midy-35);
line(midx-5,midy-25,midx-5,midy+5);
line(midx+5,midy-35,midx+5,midy-5);
line(midx-6,midy+5,midx-2,midy+5);
line(midx+2,midy-5,midx+6,midy-5);
}
else {
line(x2,y2-7,midx-5,midy-35);
line(x2,y2-7,midx+5,midy-25);
line(midx-5,midy-35,midx-5,midy-5);
line(midx+5,midy-25,midx+5,midy+5);
line(midx-6,midy-5,midx-2,midy-5);
line(midx+2,midy+5,midx+6,midy+5);
}
setcolor(RED);
setlinestyle(0,0,3);
line(x1,y1,x2,y2);
line(midx,midy,x1,y1);
line(midx,midy,x2,y2);
line(midx-35,midy,x1,y1);
line(midx+35,midy,x2,y2);
moveto(x1,y1);
linerel(1,-6);
moveto(x1+1,y1-6);
linerel(8,-10);
linerel(6,1);
setcolor(BLUE);
setlinestyle(0,0,1);
lineto(x2,y2-42);
setlinestyle(0,0,3);
setcolor(RED);
moveto(x1+1,y1-6);
linerel(-8,10);
linerel(6,1);
setcolor(BLUE);
setlinestyle(0,0,1);
lineto(x2,y2-42);
setlinestyle(0,0,3);
setcolor(RED);
moveto(x2+4,y2-3);
linerel(3,-8);
linerel(-20,2);
lineto(x2+4,y2-3);
moveto(x2,y2);
linerel(0,-3);
}