刚改写了一个小C游戏,只是个小样,大家见笑一下吧..嘿嘿,.. 不过,通过学习和改写的过程,学了一些东西,挺满足的 (别小看这点小玩意儿,花了我一天时间) #include <math.h> #include <conio.h> #include <stdio.h> #include <stdlib.h> #include <graphics.h> main() { int gdriver,gmode,c,b,i,l,j,k; c=1; gdriver=DETECT; initgraph(&gdriver,&gmode,""); setwritemode(XOR_PUT);
setcolor(BLUE); rectangle(180+c*100,350,220+c*100,390); rectangle(170+c*100,340,230+c*100,350); rectangle(190+c*100,320,210+c*100,340); rectangle(170+c*100,390,230+c*100,400); setcolor(5); line(190+c*100,350,190+c*100,390); line(200+c*100,350,200+c*100,390); line(210+c*100,350,210+c*100,390); line(200+c*100,300,200+c*100,320); line(185+c*100,300,215+c*100,300); loop: do {
for(i=rand()%3,l=rand()%3,j=-20;j<=70;j++) { rectangle(170+i*100,j*10,230+i*100,60+j*10); rectangle(160+i*100,70+j*10,240+i*100,260+j*10); line(180+i*100,70+j*10,180+i*100,260+j*10); line(200+i*100,70+j*10,200+i*100,260+j*10); line(220+i*100,70+j*10,220+i*100,260+j*10);
if(j>=10) { k=j-20; rectangle(170+l*100,k*10,230+l*100,60+k*10); /*rectangle(160+l*100,70+k*10,240+l*100,260+k*10); */ /*line(180+l*100,70+k*10,180+l*100,260+k*10); line(200+l*100,70+k*10,200+l*100,260+k*10); line(220+l*100,70+k*10,220+l*100,260+k*10); */
}
delay(2000);
rectangle(170+i*100,j*10,230+i*100,60+j*10); rectangle(160+i*100,70+j*10,240+i*100,260+j*10); line(180+i*100,70+j*10,180+i*100,260+j*10); line(200+i*100,70+j*10,200+i*100,260+j*10); line(220+i*100,70+j*10,220+i*100,260+j*10); if(j>=10) { rectangle(170+l*100,k*10,230+l*100,60+k*10); /*rectangle(160+i*100,70+k*10,240+l*100,260+k*10);*/ /*line(180+l*100,70+k*10,180+l*100,260+k*10); line(200+l*100,70+k*10,200+l*100,260+k*10); line(220+l*100,70+k*10,220+l*100,260+k*10); */
} } }while(bioskey(1)==0); b=bioskey(0);
setcolor(BLUE); rectangle(180+c*100,350,220+c*100,390); rectangle(170+c*100,340,230+c*100,350); rectangle(190+c*100,320,210+c*100,340); rectangle(170+c*100,390,230+c*100,400); setcolor(5); line(190+c*100,350,190+c*100,390); line(200+c*100,350,200+c*100,390); line(210+c*100,350,210+c*100,390); line(200+c*100,300,200+c*100,320); line(185+c*100,300,215+c*100,300);
if((b==0x4b00)&&(c>0)) c--; else if((b==0x4d00)&&(c<2)) c++;
else if((b==0x5000)&&(c<2)) sleep(1);
setcolor(BLUE);
setcolor(BLUE); rectangle(180+c*100,350,220+c*100,390); rectangle(170+c*100,340,230+c*100,350); rectangle(190+c*100,320,210+c*100,340); rectangle(170+c*100,390,230+c*100,400); setcolor(5); line(190+c*100,350,190+c*100,390); line(200+c*100,350,200+c*100,390); line(210+c*100,350,210+c*100,390); line(200+c*100,300,200+c*100,320); line(185+c*100,300,215+c*100,300); goto loop;
}
[此贴子已经被作者于2005-1-15 20:33:50编辑过]