feat(MCU课设): 更改分数显示方式
This commit is contained in:
parent
8c76f3a6d3
commit
5873aa5ba2
2 changed files with 25 additions and 18 deletions
|
@ -5,12 +5,13 @@
|
||||||
#include "delay.h"
|
#include "delay.h"
|
||||||
|
|
||||||
char base[MAX_X][MAX_Y] = {0}; //x*y //0为空 1为下落完成 2为正在下落
|
char base[MAX_X][MAX_Y] = {0}; //x*y //0为空 1为下落完成 2为正在下落
|
||||||
extern unsigned char score;
|
extern unsigned int score;
|
||||||
extern enum OPR opr;
|
extern enum OPR opr;
|
||||||
enum GS blockGameStatus = __idle;
|
enum GS blockGameStatus = __idle;
|
||||||
|
|
||||||
void blockInit()
|
void blockInit()
|
||||||
{
|
{
|
||||||
|
score=0;
|
||||||
blockGameStatus = start;
|
blockGameStatus = start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,10 +156,13 @@ void dropPiece()
|
||||||
}
|
}
|
||||||
//有标记则转换
|
//有标记则转换
|
||||||
else if(flag == 1)
|
else if(flag == 1)
|
||||||
|
{
|
||||||
|
score++;
|
||||||
base[i][j] = 1;
|
base[i][j] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +229,7 @@ void judgeBlock()
|
||||||
//计数足则整体下移
|
//计数足则整体下移
|
||||||
if(count == 8)
|
if(count == 8)
|
||||||
{
|
{
|
||||||
score++;
|
score=score+10;
|
||||||
blockGameStatus = good;
|
blockGameStatus = good;
|
||||||
for(k = 0; k < MAX_X; k++)
|
for(k = 0; k < MAX_X; k++)
|
||||||
for(h = j ; h < MAX_Y - 1; h++)
|
for(h = j ; h < MAX_Y - 1; h++)
|
||||||
|
|
|
@ -15,16 +15,15 @@
|
||||||
|
|
||||||
Menu M_MAINMENU;//主菜单
|
Menu M_MAINMENU;//主菜单
|
||||||
Menu M_BLOCK; //俄罗斯方块
|
Menu M_BLOCK; //俄罗斯方块
|
||||||
Menu M_BALL; //弹球
|
Menu M_BEST; //弹球
|
||||||
|
Menu M_ABOUT; //关于
|
||||||
Menu M_ABOUT;
|
|
||||||
|
|
||||||
Menu* NOW; //当前菜单指针
|
Menu* NOW; //当前菜单指针
|
||||||
Menu* LAST = NULL; //上一个状态的菜单
|
Menu* LAST = NULL; //上一个状态的菜单
|
||||||
|
|
||||||
enum OPR opr = idle;
|
enum OPR opr = idle;
|
||||||
static unsigned char local[10] = {0};
|
static unsigned char local[10] = {0};
|
||||||
unsigned char score = 0;
|
unsigned int score = 0;
|
||||||
extern enum GS blockGameStatus;
|
extern enum GS blockGameStatus;
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ void m_mainmenu(struct _menu* this)
|
||||||
NOW = &M_BLOCK; //转向下一菜单
|
NOW = &M_BLOCK; //转向下一菜单
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
NOW = &M_BALL; //转向下一菜单
|
NOW = &M_BEST; //转向下一菜单
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
NOW = &M_ABOUT; //转向下一菜单
|
NOW = &M_ABOUT; //转向下一菜单
|
||||||
|
@ -115,18 +114,22 @@ void m_block(struct _menu* this)
|
||||||
switch(blockGameStatus)
|
switch(blockGameStatus)
|
||||||
{
|
{
|
||||||
case good:
|
case good:
|
||||||
drawGOOD(70, 2);
|
drawGOOD(70, 4);
|
||||||
blockGameStatus=start;
|
blockGameStatus=start;
|
||||||
break;
|
break;
|
||||||
case over:
|
case over:
|
||||||
drawGAME(70, 2);
|
drawGAME(70, 4);
|
||||||
drawOVER(70, 4);
|
drawOVER(70, 6);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
drawVOID8(70, 2, 40);
|
drawVOID8(70, 4, 40);
|
||||||
drawVOID8(70, 4, 32);
|
drawVOID8(70, 6, 32);
|
||||||
}
|
}
|
||||||
drawSUPNUM(110, 0, score); //绘制分数
|
drawSUPNUM(70, 2, score/10000); //绘制分数
|
||||||
|
drawSUPNUM(78, 2, score/1000);
|
||||||
|
drawSUPNUM(86, 2, score/100);
|
||||||
|
drawSUPNUM(94, 2, score/10);
|
||||||
|
drawSUPNUM(102, 2, score%10);
|
||||||
blockGameOver(); //检查是否游戏结束
|
blockGameOver(); //检查是否游戏结束
|
||||||
genPiece(); //若有需要,生成新块
|
genPiece(); //若有需要,生成新块
|
||||||
dropPiece(); //若有需要,块下落
|
dropPiece(); //若有需要,块下落
|
||||||
|
|
Reference in a new issue