?? xiaoxionghuijia.txt
字號:
have_jump++;
goto right_s;
}
if(xyz==72)
{
have_jump=0;
up=1;
now_jump=0;
high=0;
down=0;
}
/*right*/
right_s: if(xyz==77)
{
right=1;
bear_x++;
}
/*quit*/
if(xyz==27)
{
setcolor(YELLOW);
settextstyle(0,0,1);
outtextxy(200,170,"Quit? Y/N");
quits: quit=getch();
if(quit=='y') end_1(); /*will goto a subfunction,,,,,*/
if((quit!='y')&&(quit!='n')) goto quits;
putimage(200,170,blue,COPY_PUT);
putimage(240,170,blue,COPY_PUT);
}
/*plause*/
if(xyz==75)
{
setcolor(YELLOW);
settextstyle(0,0,1);
outtextxy(100,170,"Press any key to continue...");
getch();
putimage(100,170,blue,COPY_PUT);
putimage(140,170,blue,COPY_PUT);
putimage(180,170,blue,COPY_PUT);
putimage(220,170,blue,COPY_PUT);
putimage(260,170,blue,COPY_PUT);
putimage(300,170,blue,COPY_PUT);
}
xyz=0;
/*jump,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*/
if(now_jump<140){
/*jump up*/
if(high<70){
putimage(A.x,A.y,bear,XOR_PUT);
A.y=A.y-2;
putimage(A.x,A.y,bear,COPY_PUT);
high++;}
/*jump down*/
if((high==70)&&(down<70)){
putimage(A.x,A.y,bear,XOR_PUT);
A.y=A.y+2; if((block_l_u.x<=140)&&(A.y>=70)&&(n==0) ){A.y=70;}
putimage(A.x,A.y,bear,COPY_PUT);
down++;}
now_jump++;}
/*if jump down*/
if((right==1)&&(n==100)&&(A.y==70)&&(have_jump==140))
{
for(A.y=70;A.y<200;A.y++)
{
putimage(A.x,A.y,bear,XOR_PUT);
putimage(A.x,A.y+1,bear,COPY_PUT);
delay(5*delay_n);
}
}
/*the other condition*/
if((have_jump<140)&&(n==100)) kg_2=1;
if((kg_2==1)&&(have_jump==140))
{
for(A.y=70;A.y<200;A.y++)
{
putimage(A.x,A.y,bear,XOR_PUT);
putimage(A.x,A.y+1,bear,COPY_PUT);
delay(5*delay_n);
}
kg_2=0;
}
/*about************************************************************ FIRE*/
if ((abc>=20)&&(abc<=30)&&(have_fire==0)&&(in_screen<=8))
{
fire_l_u.x=480;
fire_l_u.y=220;
have_fire=1;
in_screen++;
}
/*fire*/
if(have_fire==1){
putimage(fire_l_u.x,fire_l_u.y,fire,XOR_PUT);
have_fire=1;
fire_l_u.x=fire_l_u.x-2 ; /*STEP,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*/
putimage(fire_l_u.x,fire_l_u.y,fire,COPY_PUT);}
if(fire_l_u.x==0)
{
putimage(0,220,blue,COPY_PUT);/*clear,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*/
have_fire=0;
in_screen--;
fire_l_u.x=1;
}
/*blood*/
if((fire_l_u.x<=125)&&(fire_l_u.x>=75)&&(A.y>=150))
{
blood--;/*down_blood();*/
}
/*about***************************************************************BIRD*/
if ((abc>=30)&&(abc<=40)&&(have_bird==0)&&(in_screen<=8))
{
bird_l_u.x=480;
bird_l_u.y=30;
have_bird=1;
in_screen++;
}
/*bird*/
if(have_bird==1){
putimage(bird_l_u.x,bird_l_u.y,bird,XOR_PUT);
bird_l_u.x--;
bird_l_u.y=30+30*sin(0.05*bird_l_u.x+90); ; /*STEP,,,,,,,,,,,*/
putimage(bird_l_u.x,bird_l_u.y,bird,OR_PUT);}
if(bird_l_u.x==0)
{
putimage(0,bird_l_u.y,blue,COPY_PUT);
putimage(20,bird_l_u.y,blue,COPY_PUT);
putimage(10,bird_l_u.y+30,blue,COPY_PUT);/*will draw a backcolor bar to clear it*/
have_bird=0;
in_screen--;
bird_l_u.x=1;
}
/*blood*/
if((bird_l_u.x<=130)&&(bird_l_u.x>=100)&&(bird_l_u.y<=A.y+50)&&(bird_l_u.y+60>=A.y+10))
{
blood--;/*down_blood();*/
}
/*about***************************************************************APPLE*/
if((abc>=40)&&(abc<=45)&&(have_apple==0)&&(in_screen<=8))
{
apple_l_u.x=480;
apple_l_u.y=110;
have_apple=1;
in_screen++;
eat_apple=0;
}
/*rand grow APPLE*/
if((have_apple==1)&&(right==1)&&(eat_apple==0)){
putimage(apple_l_u.x,apple_l_u.y,apple,XOR_PUT);
apple_l_u.x=apple_l_u.x-10;/*STEP,,,,,,suggest the same as road...,,,,,,,,,,*/
putimage(apple_l_u.x,apple_l_u.y,apple,COPY_PUT);}
if(apple_l_u.x==0)
{
if((right==1)&&(apple_l_u.x==0)) putimage(0,apple_l_u.y,blue,COPY_PUT);/*you will need CLEAR*/
have_apple=0;
in_screen--;
apple_l_u.x=1;
}
/*apple*/
if((apple_l_u.x<=140)&&(apple_l_u.x>=100)&&(A.y==70)&&(eat_apple==0))
{
/*add experience();*/
life++; eat_apple=1;
putimage(140,90,blue,COPY_PUT);
putimage(110,5,blue,COPY_PUT);
}
/*about***************************************************************BLOCK*/
if((abc>=50)&&(abc<=60)&&(have_block==0)&&(in_screen<=8))
{
block_l_u.x=480;
block_l_u.y=130;
have_block=1;
in_screen++;
}
/*draw*/
if((have_block==1)&&(right==1)&&(block_l_u.x>0)){
putimage(block_l_u.x,block_l_u.y,short_block,XOR_PUT);
block_l_u.x=block_l_u.x-10;/*this STEP MUST same as the road and the dump!!!,,*/
putimage(block_l_u.x,block_l_u.y,short_block,COPY_PUT);}
if(block_l_u.x==0) {kg=1;
if((right==1)&&(kg==1)&&(n<=200)) {
putimage(200-n,130,blue,COPY_PUT);
n=n+10; } }
if(n==210){ n=0;kg=0;
block_l_u.x=480;
have_block=0;
in_screen--;
}
/*ABOUT ROAD.......................................................... */
/*go ahead*/
if(right==1)
{
putimage(0,260,road,XOR_PUT);
road_x++;
if(road_x==1) road=road_1;
if(road_x==2) road=road_2;
if(road_x==3) road=road_3;
if(road_x==4) road=road_4;
putimage(0,260,road,COPY_PUT); putimage(0,270,long_block,COPY_PUT);
if(road_x==4) road_x=0;
}
/*about***************************************************************DUMP*/
if((abc>=60)&&(abc<=70)&&(have_dump==0)&&(in_screen<=8))
{
dump_l.x=480;
dump_l.y=260;
have_dump=1;
in_screen++;
}
/*rand Judge dump*/
/*dump*/
if((have_dump==1)&&(right==1)){
putimage(dump_l.x,260,dump,XOR_PUT);
dump_l.x=dump_l.x-10;/*SAME AS the ROAD,,,,,,,,,,,,,,,,,,,,,,,,,,,,*/
putimage(dump_l.x,260,dump,COPY_PUT);}
if(dump_l.x !=1) putimage(dump_l.x,260,dump,COPY_PUT);
if(dump_l.x==-80)
{
/*also will CLEAR it ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*/
have_dump=0;
in_screen--;
dump_l.x=1;
}
/*Judge dump*/
if ((A.y>=200)&&(dump_l.x<=A.x)&&(dump_l.x+80>=A.x+40))
{
for(A.y=200;A.y<=250;A.y++)
{
putimage(100,A.y,bear,XOR_PUT);
putimage(100,A.y,bear,COPY_PUT);
delay(8*delay_n);
}
life--; if(life!=0) { A.y=200;dump_l.x=1;
settextstyle(0,0,1);
outtextxy(100,170,"Press any key to continue...");
getch();
putimage(100,170,blue,COPY_PUT);
putimage(140,170,blue,COPY_PUT);
putimage(180,170,blue,COPY_PUT);
putimage(220,170,blue,COPY_PUT);
putimage(260,170,blue,COPY_PUT);
putimage(300,170,blue,COPY_PUT);
putimage(110,5,blue,COPY_PUT); goto start;} /*dead()*/
}
/*test*/
if(bear_x==500)/*adjust*/
final(blood,life);
setfillstyle(1,RED);
setcolor(RED);
bar(300,2,400,23);
setfillstyle(1,YELLOW);
setcolor(YELLOW);
bar(300,5,400-blood,20);
settextstyle(0,0,2);
outtextxy(200,5,"Blood:");
if(blood==0)
{life--;putimage(110,5,blue,COPY_PUT);blood=100;}
if(life==0) game_over();
sprintf(t,"Life:%d",life);
outtextxy(30,5,t);
if(life>=8) life=8;
right=0;
while(bioskey(1)) getch();
goto start;
/*THE FINAL*/
out: goto start;
}
void end_1() /*only use once*/
{
closegraph();exit(0);
}
void final(blood_s,life_s)
{
void score(int);
int bb;
int cc;
int nscore;
char s[10];
setfillstyle(1,RED);
setcolor(RED);
line(375,65,280,160);
line(375,65,470,160);
line(280,160,470,160);
floodfill(375,130,RED);
setfillstyle(1,YELLOW);
setcolor(YELLOW);
bar(310,160,440,245);
setfillstyle(1,BLUE);
setcolor(BLUE);
bar(275,245,475,260);
setfillstyle(8,BLUE);
pieslice(375,190,0,360,20);
settextstyle(0,0,4);
for(bb=0;bb<=10;bb++)
for(cc=0;cc<=14;cc++){
delay(50*delay_n);
setcolor(cc);
outtextxy(0,60,"CONGRATULATIONS!");}
setcolor(RED);
outtextxy(0,60,"CONGRATULATIONS!");
settextstyle(4,0,2);
setcolor(BLUE);
nscore=blood_s+life_s*100-50;
sprintf(s,"Score:%d",nscore);
outtextxy(320,220,s);
score(nscore);
}
void game_over()
{
int a;
setfillstyle(1,LIGHTBLUE);
setcolor(LIGHTBLUE);
for(a=0;a<=5000;a++)
{
pieslice(rand()%480,rand()%340,0,360,2);
}
settextstyle(0,0,5);
setcolor(YELLOW);
outtextxy(60,60,"GAME OVER");
settextstyle(0,0,1);
outtextxy(100,170,"Press [Enter] to exit.");
getchar();closegraph();exit(0);
}
void score(scor)
{
struct information
{
char name[10];
int score;
}bear[9];
FILE *inform;
int s_box;
char name[10];
struct information temp;
int c,d,e;
for(s_box=0;s_box<=160;s_box++)
{
setcolor(BLUE); delay(100*delay_n);
line(0,100+s_box,240,100+s_box);
}
setviewport(80,170,360,330,0);
settextstyle(0,0,1);
setcolor(YELLOW);
if((inform=fopen("BEAR.abc","r"))==NULL)
{
outtextxy(5,5,"File system error,press [Enter] to exit.");
getchar();
closegraph();
exit(0);
}
for(c=0;c<=7;c++)
{
fscanf(inform,"%s %d ",bear[c].name,&bear[c].score);
}
/*get bear information*/
printf("\n\n\n\n\n\n\n\n\n\n\n\t\t\t ");
setfillstyle(1,BLUE);
setcolor(BLUE);
bar(0,0,240,160);
setcolor(YELLOW);
outtextxy(10,10,"Input your name:");
scanf("%s",&bear[8].name);
setfillstyle(1,BLUE);
setcolor(BLUE);
bar(0,0,240,160);
bear[8].score=scor; printf("%d",scor);
for(d=0;d<=7;d++)
for(e=d+1;e<=8;e++)
if(bear[d].score<bear[e].score)
{
temp=bear[d];
bear[d]=bear[e];
bear[e]=temp;
}
setcolor(YELLOW);
for(c=0;c<=8;c++)
{
sprintf(name,"%d.",c+1);
outtextxy(5,15+15*c,name);
sprintf(name,"Name:%s",bear[c].name);
outtextxy(20,15+15*c,name);
sprintf(name,"Score:%d",bear[c].score);
outtextxy(150,15+15*c,name);
}
fclose(inform);
inform=fopen("BEAR.abc","w");
for(c=0;c<=7;c++)
fprintf(inform," %s %d ",bear[c].name,bear[c].score);
fclose(inform);
outtextxy(280,150,"Press [Enter] to exit.");
getchar(); getchar();
closegraph();
exit(0);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -