没有合适的资源?快使用搜索试试~ 我知道了~
小游戏源代码深度解析汇总
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 186 浏览量
2022-07-02
21:06:02
上传
评论
收藏 171KB DOC 举报
温馨提示
试读
28页
小游戏源代码深度解析汇总
资源推荐
资源详情
资源评论
/************************************
* Desc:
* By:
俄罗斯方块游戏
hoodlum1980
* Email
* Date:
22:30
************************************/
#include <>
#include <>
#include <>
#include <>
#include <>
#include <>
#define true
1
#define false
0
#define BoardWidth
#define BoardHeight
12
23
#define _INNER_HELPER /*inner helper method */
/*Scan Codes Define*/
enum KEYCODES
{
K_ESC
K_UP
=0x011b,
=0x4800,
/* upward arrow */
K_LEFT
K_DOWN
K_RIGHT
K_SPACE
K_P
=0x4b00,
=0x5000,
=0x4d00,
=0x3920,
=0x1970
};
/* the data structure of the block */
typedef struct tagBlock
{
char c[4][4];
1-filled */
int x;
-1] */
/* cell fill info array, 0-empty,
/* block position cx [ 0,BoardWidht
/* block position cy
int y;
[-4,BoardHeight-1] */
char color;
char size;
/* block color */
/* block max size in width or height */
/* block name (the block's shape) */
char name;
} Block;
/* game's global info */
int FrameTime= 1300;
int CellSize= 18;
int BoardLeft= 30;
int BoardTop=
30;
/* next block grid */
int NBBoardLeft= 300;
int NBBoardTop=
30;
int NBCellSize= 10;
/* score board position */
int ScoreBoardLeft= 300;
int ScoreBoardTop=100;
int ScoreBoardWidth=200;
int ScoreBoardHeight=35;
int ScoreColor=LIGHTCYAN;
/* infor text postion */
int InfoLeft=300;
int InfoTop=200;
int InfoColor=YELLOW;
int BorderColor=DARKGRAY;
int BkGndColor=BLACK;
int GameRunning=true;
int TopLine=BoardHeight-1;
int TotalScore=100;
/* top empty line */
char info_score[20];
char info_help[255];
char info_common[255];
/*
Board[x][y][1]-fillColor */
unsigned char Board[BoardWidth][BoardHeight][2];
our
board,
Board[x][y][0]-isFilled,
char BufferCells[4][4];
*/
/* used to judge if can rotate block
Block curBlock;
/* current moving block */
/* next Block to appear */
Block nextBlock;
/* function list */
int GetKeyCode();
int CanMove(int dx,int dy);
int CanRotate();
int RotateBlock(Block *block);
int MoveBlock(Block *block,int dx,int dy);
void DrawBlock(Block *block,int,int,int);
void EraseBlock(Block *block,int,int,int);
void DisplayScore();
void DisplayInfo(char* text);
void GenerateBlock(Block *block);
void NextBlock();
void InitGame();
int PauseGame();
void QuitGame();
/*Get Key Code */
int _INNER_HELPER GetKeyCode()
{
int key=0;
if(bioskey(1))
{
key=bioskey(0);
}
return key;
}
/* display text! */
void _INNER_HELPER DisplayInfo(char *text)
{
setcolor(BkGndColor);
outtextxy(InfoLeft,InfoTop,info_common);
剩余27页未读,继续阅读
资源评论
码农.one
- 粉丝: 7
- 资源: 345
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功