C语言俄罗斯方块游戏源代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

/*学无止境*/ #include <>

#include <>

#include <>

#define ESC 27

#define UP 328

#define DOWN 336

#define LEFT 331

#define RIGHT 333

#define BLANK 32

#define BOTTOM 2

#define CANNOT 1

#define CAN 0

#define MAX 30

#define F1 315

#define ADD 43

#define EQUAL 61

#define DEC 45

#define SOUNDs 115

#define SOUNDS 83

#define PAUSEP 80

#define PAUSEp 112

void Init();

void Down();

void GoOn();

void ksdown();

void Display(int color);

void Give();

int Touch(int x,int y,int dx,int dy);

int GeyKey();

void Select();

void DetectFill();

void GetScores();

void Fail();

void Help();

void Quit();

void DrawBox(int x,int y,int Color);

void OutTextXY(int x,int y,char *String); void DispScore(int x,int y,char Ch);

void DrawNext(int Color);

int Heng=12,Shu=20; /*横竖*/

int Position[MAX][MAX];

int middle[MAX][MAX];

int ActH,ActS;

int Act,Staus;

int i,j,k;

int Wid=10;

int NoPass=CAN;

float Delays=15000;

int BeginH=250,BeginS=7;

float Seconds=0;

int Scores=0;

int flag=1;

int Sounds=CAN;

int PreAct,NextAct;

int a[8][4][4][4]={{{1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0}, {1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0},

{1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0},

{1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0}},

{{1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0},

{1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0},

{1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0},

{1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0}},

{{1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0},

{0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0},

{0,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0},

{1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0}}, {{1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0}, {0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0}, {1,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0}, {0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0}}, {{0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0}, {1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0}, {0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0}, {1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0}}, {{1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0}, {1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0}, {1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0}, {0,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0}}, {{0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0}, {1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0}, {1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0}, {1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0}}, {{1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}; int b[4][4];

main(int argc,char *argv[])

{

if (argc!=1)

{

if (argv[1]!="")

Heng=atoi(argv[1]);

if (argv[2]!="")

Shu=atoi(argv[2]);

}

Init(); /*初始化界面*/

PreAct=random(8); /*取得当前的方块*/

for(;;) /*以下是游戏流程*/

{

NextAct=random(8); /*取得下一个方块*/ DrawNext(1); /*画出下一个方块*/

Act=PreAct;

if (Heng%2==0) ActH=Heng/2;

else ActH=(Heng-1)/2;

ActS=0; /*方块开始从游戏空间的中间下落*/ Staus=0; /*取开始的状态*/

NoPass=CAN; /*物体可以下落*/

Give(); /*取得当前的方块*/

相关文档
最新文档