该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
/*呵呵,其实这个没什么技术含量,自我感觉就像在放幻灯片一样!呵呵,
我没学过数据结构,所以写得很乱,还望见谅!(不过我准备学了!)
做这个只是放松一下心情,太累了!
以下在TC2.0/XP 通过编译*/
#include
#include
#include
#include
#include
#include
#include
#define ESC 0x011b
#define LEFT 0x4b00
#define RIGHT 0x4d00
#define D 0x2064 /* 用手攻击 */
#define F 0x2166 /* 用脚攻击 */
void gameplay()
{
void shiftleft(int move);
void fail();
void win();
void shiftright(int move);
void score(int blood,int blood1);
void onset_by_hand(int move,int j,int k);
void onset_by_leg(int move,int b,int v,int c);
void opponent(int move1,int y,int h,int u,int w,int s,int o,int p);
void drawmap();
int key,move=0,move1=0,j=0,k=0,a=1,t=1,b=0,c=0,v=0,x,e;
int y=520,h=480,u=320,w=490,s=240,o=480,p=260,f1;
int blood=0,blood1=0;
shiftright(move);
score(blood,blood1);
opponent(move1,y,h,u,w,s,o,p);
drawmap();
while(1)
{
f1=random(4);
key=bioskey(0);
if(blood1>=100)
{
cleardevice();
win();
sleep(10);
closegraph();
exit(0);
}
if(key==RIGHT)
{
if(move<410&&move<330+move1)
{
move+=5;
cleardevice();
shiftright(move);
drawmap();
opponent(move1,y,h,u,w,s,o,p);
score(blood,blood1);
}
else
getch();
a=0;
t=0;
}
else if(key==LEFT)
{
if(move>-60)
{
move-=5;
cleardevice();
shiftleft(move);
drawmap();
opponent(move1,y,h,u,w,s,o,p);
score(blood,blood1);
}
else
getch();
a=0;
t=0;
}
else if(key==D)
{
if(a==1)
{
j=130;
k=260;
a=0;
}
else if(a==0)
{
j=160;
k=210;
a=1;
}
cleardevice();
onset_by_hand(move,j,k);
drawmap();
if(((485+move1)-(115+move))<=45)
{
move1+=50;
if(move1>80)
move1=80;
blood1+=1;
}
opponent(move1,y,h,u,w,s,o,p);
score(blood,blood1);
delay(1000);
t=0;
}
else if(key==F)
{
if(t==1)
{
b=80;
v=120;
c=320;
t=0;
}
else if(t==0)
{
b=100;
v=180;
c=240;
t=1;
}
cleardevice();
onset_by_leg(move,b,v,c);
drawmap();
if(((485+move1)-(115+move))<=45)
{
move1+=60;
if(move1>80)
move1=80;
blood1+=2;
}
opponent(move1,y,h,u,w,s,o,p);
score(blood,blood1);
delay(1000);
a=0;
}
else if(key==ESC)
{
cleardevice();
settextstyle(0,0,3);
outtextxy(200,100,"GAME OVER !");
sleep(10);
closegraph();
exit(0);
}
else
getch();
if(f1==2||f1==0) /*对手的移动*/
{
while(!kbhit())
{
if(move1>-390&&((485+move1)-(115+move))>40)
{