From 765045e00a19af4fecade459da78a86b9e5e89c9 Mon Sep 17 00:00:00 2001 From: iridiumR Date: Wed, 8 Jun 2022 00:00:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(MCU=E8=AF=BE=E8=AE=BE):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=96=B9=E5=9D=97=E7=A7=8D=E7=B1=BB=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=AD=98=E5=82=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MCU/MCU_REAL_FINAL/block.c | 71 +++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/MCU/MCU_REAL_FINAL/block.c b/MCU/MCU_REAL_FINAL/block.c index 71398c0..eab30c2 100644 --- a/MCU/MCU_REAL_FINAL/block.c +++ b/MCU/MCU_REAL_FINAL/block.c @@ -53,7 +53,7 @@ void genPiece() char i, j; //需要一点随机性 - int random = TH0 % 10; + int random = TH0 % 16; if(blockGameStatus == over) @@ -106,13 +106,53 @@ void genPiece() } else if (random == 8) { - base[4][9] = 2; + base[4][10] = 2; base[3][9] = 2; base[4][9] = 2; + } + else if (random == 9) + { + base[4][9] = 2; + base[3][10] = 2; + base[4][10] = 2; + } + else if (random == 10) + { + base[3][9] = 2; + base[3][10] = 2; + base[4][10] = 2; } //当四个方块的情况 - else if(random == 9) + else if(random == 11) + { + base[3][10] = 2; + base[4][10] = 2; + base[3][9] = 2; + base[4][9] = 2; + } + else if(random == 12) + { + base[3][10] = 2; + base[4][10] = 2; + base[3][9] = 2; + base[4][11] = 2; + } + else if(random == 13) + { + base[3][10] = 2; + base[4][10] = 2; + base[3][11] = 2; + base[4][9] = 2; + } + else if(random == 14) + { + base[3][10] = 2; + base[4][10] = 2; + base[4][9] = 2; + base[5][9] = 2; + } + else if(random == 15) { base[3][10] = 2; base[4][10] = 2; @@ -284,31 +324,6 @@ void blockGameOver() //结束则填满 if(blockGameStatus == over) { - //写入排行榜 - if(addBest(score)) - { - IapEraseSector(IAP_ADDRESS); - IapProgramByte(IAP_ADDRESS + 0, bestScore[0] >> 8); - IapProgramByte(IAP_ADDRESS + 1, bestScore[0] % 256); - IapProgramByte(IAP_ADDRESS + 2, bestScore[1] >> 8); - IapProgramByte(IAP_ADDRESS + 3, bestScore[1] % 256); - IapProgramByte(IAP_ADDRESS + 4, bestScore[2] >> 8); - IapProgramByte(IAP_ADDRESS + 5, bestScore[2] % 256); - IapProgramByte(IAP_ADDRESS + 6, bestScore[3] >> 8); - IapProgramByte(IAP_ADDRESS + 7, bestScore[3] % 256); - IapProgramByte(IAP_ADDRESS + 8, bestScore[4] >> 8); - IapProgramByte(IAP_ADDRESS + 9, bestScore[4] % 256); - IapProgramByte(IAP_ADDRESS + 10, bestScore[5] >> 8); - IapProgramByte(IAP_ADDRESS + 11, bestScore[5] % 256); - IapProgramByte(IAP_ADDRESS + 12, bestScore[6] >> 8); - IapProgramByte(IAP_ADDRESS + 13, bestScore[6] % 256); - IapProgramByte(IAP_ADDRESS + 14, bestScore[7] >> 8); - IapProgramByte(IAP_ADDRESS + 15, bestScore[7] % 256); - IapProgramByte(IAP_ADDRESS + 16, bestScore[8] >> 8); - IapProgramByte(IAP_ADDRESS + 17, bestScore[8] % 256); - IapProgramByte(IAP_ADDRESS + 18, bestScore[9] >> 8); - IapProgramByte(IAP_ADDRESS + 19, bestScore[9] % 256); - } for(j = 0; j < MAX_Y; j++) for(i = 0; i < MAX_X; i++) {