揖劔頁恷兜化議庁亭,嗤棋壅頼鋲和肇.敬禦堀業貧議諒籾珊頁錬李寄社徭失距屁gamespeed議堀業.
腎鯉頁窟符,窟符議醤悶劔徨厘短亟.
#include <graphics.h>
#include <math.h>
#include <stdlib.h>
#include <dos.h>
#define KEY_ESC 0x01
#define KEY_SPACE 0x39
#define KEY_UP 0x48
#define KEY_LEFT 0x4b
#define KEY_RIGHT 0x4d
#define KEY_DOWN 0x50
int gamespeed=1200; /*徭失個嗄老議堀業*/
int speed; /*敬禦卞強堀業*/
int col; /*嶄伉恫炎*/
int score=0; /*誼蛍*/
char key_state[128],key_pressed[128]; /*囚徒荷恬喘議延楚*/
void Init(); /*兜兵*/
void Close(); /*購液*/
void PlayGame(); /*嗄老狛殻*/
void PrScore(); /*補竃撹示*/
void DrawM(int x,int y,int color); /*鮫忠彈匂*/
void Win(); /*補竃恷朔潤惚*/
int GetKey(int ScanCode); /*宸戦蝕兵脅頁梓囚痕方*/
void interrupt far (*OldInt9Handler)();
void far interrupt NewInt9();
void InstallKeyboard();
void ShutDownKeyboard();
DrawFly(int x,int y,int color); /*鮫敬禦*/
void main(void)
void PrScore()/*補竃撹示*/
{
char s[10];
setfillstyle(SOLID_FILL,BLACK);
bar(30,0,100,50);
setcolor(6);
settextstyle(0,0,2);
sprintf(s,"%d",score);
outtextxy(30,20,s);
}
void DrawM(int x,int y,int color)/*鮫忠彈匂*/
void Win()/*補竃恷朔潤惚*/
{
settextstyle(0,0,4);
setcolor(RED);
if(score>18)
outtextxy(200,200,"VERY GOOD");
else if(score>10)
outtextxy(250,200,"GOOD");
else
outtextxy(250,200,"~@_@~");
}
void PlayGame()/*嗄老狛殻*/
{
float x,y; /*敬禦議恫炎*/
int mx,my;
int i,num=0;
for(i=40;i<640;i+=30)
DrawFly(i,65,WHITE);
mx=my=300;
setcolor(15);
line(0,80,640,80);
randomize();
while(num<20)
{
PrScore(); /*補竃撹示*/
col=random(10); /*嶄伉恫炎昧字*/
col=col*20+200;
speed=2+random(2); /*敬禦堀業昧字*/
for(x=-250;x<=250;x+=speed)/*敬禦卞強畠狛殻*/
{
y=pow((x/10),2)+200; /*箔y恫炎*/
DrawFly(x,y,WHITE);
DrawM(mx,my,YELLOW);
delay(gamespeed); /*寂侯*/
DrawM(mx,my,BLACK);
DrawFly(x,y,BLACK);
if(GetKey(KEY_ESC))/*潤崩嗄老*/
break;
if(GetKey(KEY_LEFT))
mx-=4;
if(GetKey(KEY_RIGHT))
mx+=4;
if(GetKey(KEY_DOWN))
my+=4;
if(GetKey(KEY_UP)&&my>100)
my-=4;
if(GetKey(KEY_SPACE))/*窟徨起*/
{
if(((x+col+10)>=(mx-2)&&x<=(mx+2))&&(y>=(my-2)&&y<=(my+2)))/*宸戦陣崙娼
|