C语言控制台版 俄罗斯方块

时间:2016-05-09 13:08:46
【文件属性】:

文件名称:C语言控制台版 俄罗斯方块

文件大小:6KB

文件格式:RAR

更新时间:2016-05-09 13:08:46

俄罗斯方块 、 语言、 控制台版

#include #include #include #include #include #include #include "tetris.h" int main (void) { int over = 0; int nowdir = DIR_NONE; int pause = 1; int speed = 0; int layer = 0; int score = 0; int level = 1; static PointBlock thisblock; static PointBlock nextblock; SetConsoleTitle ("仿写版俄罗斯方块"); setCursorVisible (0); level = Menu(); if (level == 0) { over = 0; ShowBye (); return 0; } speed = 1000 - level * 100; if (speed < 100) speed = 100; system ("cls"); srand ((unsigned)time (NULL)); DrawMap (); DrawBlockMenu(); printscore(&score, &layer, &level); IniBlock(&thisblock, &nextblock); while (!over) { if (!pause) { MoveBlock (&thisblock, &nowdir); if (!DropBlock(&thisblock, &nextblock, &speed, &level, &score, &layer)) { over = 1; break; } // Sleep (CALTIME(level)); } if (JkHasKey ()) { switch (JkGetKey()) { case JK_UP: nowdir = DIR_UP; break; case JK_DOWN: nowdir = DIR_DOWN; break; case JK_LEFT: nowdir = DIR_LEFT; break; case JK_RIGHT: nowdir = DIR_RIGHT; break; case JK_ENTER: pause = !pause; break; case JK_ESC: over = 1; break; case JK_SPACE: if (!pause) FallDownBlock (&thisblock, &nowdir); break; default: break; } fflush(stdin); } } system ("cls"); if ('y' == ShowOver(&score)) return main(); system ("cls"); ShowBye(); return 0; }


【文件预览】:
tetris.h
tetris.c
tetrisuse.c

网友评论