diff --git a/MCU/MCU_REAL _FINAL/block.c b/MCU/MCU_REAL _FINAL/block.c index 6d5cc61..db4d175 100644 --- a/MCU/MCU_REAL _FINAL/block.c +++ b/MCU/MCU_REAL _FINAL/block.c @@ -1,9 +1,7 @@ #include "block.h" #include "draw.h" -Group piece; -unsigned char regenPieceFlag = 0; -unsigned char base[8][11]={0}; //x*y +unsigned char base[MAX_X][MAX_Y]={0}; //x*y //0为空 1为下落完成 2为正在下落 void blockInit() { @@ -16,7 +14,7 @@ base[0][2]=1; void blockDestroy() { - piece.type=none; + memset(base, 0, sizeof(base)); } void genPiece() @@ -36,11 +34,13 @@ void genPiece() { if(random % 2 == 0) { - piece.type = two_v; // - } // + base[4][8]=2; // + base[4][9]=2; // + } else { - piece.type = two_h; //// + base[3][8]=2; //// + base[4][8]=2; } } //当三个方块的情况 @@ -48,53 +48,56 @@ void genPiece() { if(random == 0) { - // - piece.type = three_h; // - // + base[4][8]=2; + base[4][9]=2; + base[4][10]=2; } else if(random == 1) { - piece.type = three_v; ////// + base[3][8]=2; + base[4][8]=2; + base[5][8]=2; } else if(random == 2) { - // - piece.type = three_l; //// + base[3][9]=2; + base[3][8]=2; + base[4][8]=2; } else if (random == 3) { - piece.type = three_r; // - } //// + base[4][9]=2; + base[3][8]=2; + base[4][8]=2; + } } //当四个方块的情况 if(len == 3) { - piece.type = four; //// - } //// + base[3][9]=2; + base[4][9]=2; + base[3][8]=2; + base[4][8]=2; + } +} +unsigned char isIegal(unsigned char i,unsigned char j) +{ + if(i>=0&&i=0&&j # include #define MAX_X 8 -#define MAX_Y 8 +#define MAX_Y 12 enum BLK_TP {none,two_h,two_v,three_l,three_r,three_h,three_v,four}; //点 结构体