stm32f103指南者——实例俄罗斯方块
一、stmf103指南者简介
- 型号:STM32F103VET6
- STM32表示32bit的MCU
- F表示基础型
- V表示100pin(即有100个引脚)
- FLASH大小E表示521KB
二、开发心得
- (为什么我要把心得放在第二块的位置,因为我真的觉得有些老师讲得真的就是喜欢站在自己的角度,来分析问题,然后觉得这些问题这么简单你们都不会亚。说什么,哎呀,你们学过C语言,模电数电学过吧,那你们去做个游戏吧…)
- 作为一个学习者分享一下我自己的经历
- 不要有畏难心理:编程只是技术,就像流水线上的工人。文件这么多都是厂商封装好的。如果想要编程做项目,浅浅理解一下stm32的机制完全足够了。
- 初学可以找个例程来分析一下,看懂别人的程序真的对于知识的理解更加深刻。
三、主程序
#include "stm32f10x.h"
#include "./usart/bsp_usart.h"
#include "./lcd/bsp_ili9341_lcd.h"
#include "./lcd/bsp_xpt2046_lcd.h"
#include "./flash/bsp_spi_flash.h"
#include "./led/bsp_led.h"
#include "palette.h"
#include <string.h>
#include "bsp_TiMbase.h"
int main(void)
{
ILI9341_Init();
XPT2046_Init();
Calibrate_or_Get_TouchParaWithFlash(6,0);
BASIC_TIM_Init();
LED_GPIO_Config();
Palette_Init(LCD_SCAN_MODE);
while ( 1 )
{
Drop();
}
}
四、主要思路
-
界面数字化 uint8_t shape_place_state[20][12] =
{
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1}
};
-
游戏界面初始化 void Palette_Init(uint8_t LCD_Mode)
{
uint8_t i;
ADCx_Init();
ILI9341_GramScan ( LCD_Mode );
score = 0;
LCD_SetBackColor(CL_WHITE);
ILI9341_Clear(0,0,LCD_X_LENGTH,LCD_Y_LENGTH);
Touch_Button_Init();
Square_Init();
Tetris_Init();
TIM_ITConfig(BASIC_TIM,TIM_IT_Update,ENABLE);
for(i=0;i<BUTTON_NUM;i++)
{
button[i].draw_btn(&button[i]);
}
}
-
俄罗斯方块设计
- 因为某种原因随机数很不好用,会出现各种奇怪的情况,目前我也不知道怎么解决。
void State_Init(){
char dis[20];
srand(ADC_ConvertedValue);
shape_num = seed;
switch(shape_num){
case SHAPE_1:
shape_place_state[0][6]=3;
shape_place_state[0][5]=3;
shape_place_state[0][7]=3;
shape_place_state[1][6]=3;
break;
case SHAPE_2:
shape_place_state[0][6]=3;
shape_place_state[1][6]=3;
shape_place_state[1][7]=3;
shape_place_state[2][6]=3;
break;
case SHAPE_3:
shape_place_state[0][6]=3;
shape_place_state[1][6]=3;
shape_place_state[1][5]=3;
shape_place_state[1][7]=3;
break;
case SHAPE_4:
shape_place_state[0][6]=3;
shape_place_state[1][6]=3;
shape_place_state[1][5]=3;
shape_place_state[2][6]=3;
break;
case SHAPE_5:
shape_place_state[0][6]=3;
shape_place_state[0][7]=3;
shape_place_state[1][6]=3;
shape_place_state[1][5]=3;
break;
case SHAPE_6:
shape_place_state[0][5]=3;
shape_place_state[1][5]=3;
shape_place_state[1][6]=3;
shape_place_state[2][6]=3;
break;
case SHAPE_7:
shape_place_state[0][6]=3;
shape_place_state[0][5]=3;
shape_place_state[1][6]=3;
shape_place_state[1][7]=3;
break;
case SHAPE_8:
shape_place_state[0][6]=3;
shape_place_state[1][6]=3;
shape_place_state[1][5]=3;
shape_place_state[2][5]=3;
break;
case SHAPE_9:
shape_place_state[0][6]=3;
shape_place_state[0][7]=3;
shape_place_state[0][5]=3;
shape_place_state[0][4]=3;
break;
case SHAPE_10:
shape_place_state[0][6]=3;
shape_place_state[1][6]=3;
shape_place_state[2][6]=3;
shape_place_state[3][6]=3;
break;
case SHAPE_11:
shape_place_state[0][6]=3;
shape_place_state[0][5]=3;
shape_place_state[1][5]=3;
shape_place_state[1][6]=3;
break;
case SHAPE_12:
shape_place_state[0][5]=3;
shape_place_state[1][5]=3;
shape_place_state[2][5]=3;
shape_place_state[2][6]=3;
break;
case SHAPE_13:
shape_place_state[0][5]=3;
shape_place_state[1][5]=3;
shape_place_state[0][7]=3;
shape_place_state[0][6]=3;
break;
case SHAPE_14:
shape_place_state[0][6]=3;
shape_place_state[0][5]=3;
shape_place_state[2][6]=3;
shape_place_state[1][6]=3;
break;
case SHAPE_15:
shape_place_state[0][7]=3;
shape_place_state[1][5]=3;
shape_place_state[1][7]=3;
shape_place_state[1][6]=3;
break;
case SHAPE_16:
shape_place_state[0][6]=3;
shape_place_state[1][6]=3;
shape_place_state[2][6]=3;
shape_place_state[2][5]=3;
break;
case SHAPE_17:
shape_place_state[0][5]=3;
shape_place_state[1][5]=3;
shape_place_state[1][7]=3;
shape_place_state[1][6]=3;
break;
case SHAPE_18:
shape_place_state[0][6]=3;
shape_place_state[0][5]=3;
shape_place_state[1][5]=3;
shape_place_state[2][5]=3;
break;
case SHAPE_19:
shape_place_state[0][6]=3;
shape_place_state[0][5]=3;
shape_place_state[0][7]=3;
shape_place_state[1][7]=3;
break;
}
}
附上这张图大家就应该明白了吧(红框是旋转的时候必须为空的格子)~
-
给方块上色(每次更新shape_place_state[i] [j]时) void Create_Shape()
{
uint8_t i;
uint8_t j;
for(i=0;i<19;i++){
for(j=1;j<11;j++){
if(shape_place_state[i][j]==3){
LCD_SetColors(CL_GREEN,CL_WHITE);
ILI9341_DrawRectangle(COLOR_BLOCK_WIDTH+(j-1)*15,15*i,15,15,1);
}
else if(shape_place_state[i][j]==0){
LCD_SetColors(CL_WHITE,CL_WHITE);
ILI9341_DrawRectangle(COLOR_BLOCK_WIDTH+(j-1)*15,15*i,15,15,1);
}
else if(shape_place_state[i][j]==2){
LCD_SetColors(CL_RED,CL_WHITE);
ILI9341_DrawRectangle(COLOR_BLOCK_WIDTH+(j-1)*15,15*i,15,15,1);
}
}
}
}
-
主要循环函数 void Drop(){
uint8_t i;
uint8_t j;
uint8_t c,x,y,flag=0;
uint8_t count=0;
uint8_t c_place[4][2] = {{0,0},{0,0},{0,0},{0,0}};
char disbuff[20];
Delay(0xfffff);
seed++;
if(seed==19)seed = 0;
if (die == 0 && MODE==1)
{
for(i=0;i<19;i++){
for(j=1;j<11;j++){
if(shape_place_state[i][j]==3){
c_place[count][0]=i;
c_place[count][1]=j;
count++;
if(shape_place_state[i+1][j]==1 || shape_place_state[i+1][j]==2){
flag += STOP;
}
else{
flag += CONTINUE;
}
}
}
}
for(c=0;c<count;c++){
x = c_place[c][0];
y = c_place[c][1];
if(flag==CONTINUE){
shape_place_state[x][y] = 0;
}
else{
shape_place_state[x][y] = 2;
judgeAlive();
State_Init();
status = shape_num;
if(die==1){
LCD_SetColors(CL_RED,CL_WHITE);
LCD_SetFont(&Font24x32);
ILI9341_DispString_EN_CH(12,120,"Game over");
TIM_ITConfig(BASIC_TIM,TIM_IT_Update,DISABLE);
while(XPT2046_TouchDetect() != TOUCH_PRESSED);
die = 0;
}
judgeRemove();
}
}
if(flag == CONTINUE){
for(c=0;c<4;c++){
shape_place_state[c_place[c][0]+1][c_place[c][1]] = 3;
}
}
Create_Shape();
}
}
-
按钮位置功能设计 void Touch_Button_Init(void)
{
button[0].start_x = BUTTON_START_X;
button[0].start_y = 320-COLOR_BLOCK_HEIGHT;
button[0].end_x = BUTTON_START_X + COLOR_BLOCK_WIDTH ;
button[0].end_y = 320;
button[0].para = LEFT;
button[0].touch_flag = 0;
button[0].draw_btn = Draw_Direction_Button;
button[0].btn_command = Command_Control_Direction ;
button[1].start_x = BUTTON_START_X + COLOR_BLOCK_WIDTH ;
button[1].start_y = 320-COLOR_BLOCK_HEIGHT;
button[1].end_x = 240-COLOR_BLOCK_WIDTH ;
button[1].end_y = 320;
button[1].para = SWITCH;
button[1].touch_flag = 0;
button[1].draw_btn = Draw_Direction_Button;
button[1].btn_command = Command_Control_Direction ;
button[2].start_x = 240-COLOR_BLOCK_WIDTH;
button[2].start_y = 320-COLOR_BLOCK_HEIGHT;
button[2].end_x = 240;
button[2].end_y = 320;
button[2].para = RIGHT;
button[2].touch_flag = 0;
button[2].draw_btn = Draw_Direction_Button;
button[2].btn_command = Command_Control_Direction ;
button[3].start_x = 240-COLOR_BLOCK_WIDTH;
button[3].start_y = 0;
button[3].end_x = 240 ;
button[3].end_y = COLOR_BLOCK_HEIGHT;
button[3].para = 0;
button[3].touch_flag = 0;
button[3].draw_btn = Draw_Mode_Button ;
button[3].btn_command = Command_Change_Mode;
}
-
暂停继续按键设计 static void Draw_Mode_Button(void *btn)
{
Touch_Button *ptr = (Touch_Button *)btn;
uint16_t RGB;
if(ptr->touch_flag == 0)
{
LCD_SetColors(CL_BUTTON_GREY,CL_WHITE);
ILI9341_DrawRectangle( ptr->start_x,
ptr->start_y,
ptr->end_x - ptr->start_x,
ptr->end_y - ptr->start_y,1);
RGB = CL_BUTTON_GREY;
}
else
{
LCD_SetColors(CL_WHITE,CL_WHITE);
ILI9341_DrawRectangle(ptr->start_x,
ptr->start_y,
ptr->end_x - ptr->start_x,
ptr->end_y - ptr->start_y,1);
RGB = CL_WHITE;
}
LCD_SetColors(CL_BLUE4,CL_WHITE);
ILI9341_DrawRectangle(ptr->start_x,
ptr->start_y,
ptr->end_x - ptr->start_x,
ptr->end_y - ptr->start_y,0);
LCD_SetColors(CL_BLACK,RGB);
LCD_SetFont(&Font8x16);
if(MODE)
{
ILI9341_DispString_EN_CH( ptr->start_x + (ptr->end_x - ptr->start_x - 16*2)/2,
ptr->start_y+ ((ptr->end_y - ptr->start_y-16)/2),
"暂停");
}
else
{
ILI9341_DispString_EN_CH( ptr->start_x + (ptr->end_x - ptr->start_x - 16*2)/2,
ptr->start_y+ ((ptr->end_y - ptr->start_y-16)/2),
"继续");
}
}
-
方向键设计 static void Draw_Direction_Button(void *btn)
{
Touch_Button *ptr = (Touch_Button *)btn;
uint16_t RGB;
if(ptr->touch_flag == 0)
{
LCD_SetColors(CL_BUTTON_GREY,CL_WHITE);
ILI9341_DrawRectangle( ptr->start_x,
ptr->start_y,
ptr->end_x - ptr->start_x,
ptr->end_y - ptr->start_y,1);
RGB = CL_BUTTON_GREY;
}
else
{
LCD_SetColors(CL_WHITE,CL_WHITE);
ILI9341_DrawRectangle(ptr->start_x,
ptr->start_y,
ptr->end_x - ptr->start_x,
ptr->end_y - ptr->start_y,1);
RGB = CL_WHITE;
}
LCD_SetColors(CL_BLUE4,CL_WHITE);
ILI9341_DrawRectangle(ptr->start_x,
ptr->start_y,
ptr->end_x - ptr->start_x,
ptr->end_y - ptr->start_y,0);
LCD_SetColors(CL_BLACK,RGB);
LCD_SetFont(&Font8x16);
switch(ptr->para)
{
case LEFT:
LCD_SetColors(CL_BLACK,RGB);
ILI9341_DispString_EN_CH( ptr->start_x + (ptr->end_x - ptr->start_x - 16)/2,
ptr->start_y+ ((ptr->end_y - ptr->start_y-16)/2),
"左");
break;
case SWITCH:
LCD_SetColors(CL_BLACK,RGB);
ILI9341_DispString_EN_CH( ptr->start_x + (ptr->end_x - ptr->start_x - 16)/2,
ptr->start_y+ ((ptr->end_y - ptr->start_y-16)/2),
"旋转");
break;
case RIGHT:
LCD_SetColors(CL_BLACK,RGB);
ILI9341_DispString_EN_CH( ptr->start_x + (ptr->end_x - ptr->start_x - 16)/2,
ptr->start_y+ ((ptr->end_y - ptr->start_y-16)/2),
"右");
break;
}
}
-
运动方向及改变形状(这里旋转的定位算法是我觉得最得意的) static void Command_Control_Direction(void *btn)
{
uint8_t i,j,cnt=0,x,y,flag=0;
uint8_t minx,miny;
uint8_t c_place[4][2]={0,0,0,0,0,0,0,0};
Touch_Button *ptr = (Touch_Button *)btn;
for(i=0;i<19;i++){
for(j=1;j<11;j++){
if(shape_place_state[i][j]==3){
c_place[cnt][0] = i;
c_place[cnt][1] = j;
cnt++;
}
}
if(cnt==4){
break;
}
}
for(i=0;i<4;i++){
x = c_place[i][0];
y = c_place[i][1];
if(shape_place_state[x][y-1]==1||shape_place_state[x][y-1]==2){
flag=1;
break;
}
else if(shape_place_state[x][y+1]==1||shape_place_state[x][y+1]==2){
flag=2;
break;
}
else{
flag=0;
}
}
if(ptr->para==LEFT && flag!=1){
for(i=0;i<4;i++){
shape_place_state[c_place[i][0]][c_place[i][1]]=0;
}
for(i=0;i<4;i++){
shape_place_state[c_place[i][0]][c_place[i][1]-1] = 3;
}
}
if(ptr->para==RIGHT && flag!=2){
for(i=0;i<4;i++){
shape_place_state[c_place[i][0]][c_place[i][1]]=0;
}
for(i=0;i<4;i++){
shape_place_state[c_place[i][0]][c_place[i][1]+1] = 3;
}
}
if(ptr->para==SWITCH){
minx = minValue(c_place[0][0],c_place[1][0],c_place[2][0],c_place[3][0]);
miny = minValue(c_place[0][1],c_place[1][1],c_place[2][1],c_place[3][1]);
switch(status){
case SHAPE_1:
if(shape_place_state[minx+1][miny]==0 && shape_place_state[minx+1][miny+2]==0){
status = SHAPE_2;
shape_place_state[minx][miny]=0;
shape_place_state[minx-1][miny+1]= 3;
}
break;
case SHAPE_2:
if(shape_place_state[minx][miny+1]==0 && shape_place_state[minx+2][miny+1]==0){
status = SHAPE_3;
shape_place_state[minx+2][miny]=0;
shape_place_state[minx+1][miny-1]= 3;
}
break;
case SHAPE_3:
if(shape_place_state[minx][miny]==0 && shape_place_state[minx][miny+2]==0){
status = SHAPE_4;
shape_place_state[minx+1][miny+2]=0;
shape_place_state[minx+2][miny+1]= 3;
}
break;
case SHAPE_4:
if(shape_place_state[minx][miny]==0 && shape_place_state[minx+2][miny]==0){
status = SHAPE_1;
shape_place_state[minx][miny+1]=0;
shape_place_state[minx+1][miny+2]= 3;
}
break;
case SHAPE_5:
if(shape_place_state[minx][miny]==0 && shape_place_state[minx-1][miny]==0
&& shape_place_state[minx-1][miny+1]==0 && shape_place_state[minx-1][miny+2]==0 )
{
status = SHAPE_6;
shape_place_state[minx+1][miny]=0;
shape_place_state[minx][miny+2]=0;
shape_place_state[minx][miny]= 3;
shape_place_state[minx-1][miny]= 3;
}
break;
case SHAPE_6:
if(shape_place_state[minx][miny+1]==0 && shape_place_state[minx][miny+2]==0
&& shape_place_state[minx+1][miny+2]==0 && shape_place_state[minx+2][miny]==0 )
{
status = SHAPE_5;
shape_place_state[minx][miny]=0;
shape_place_state[minx+1][miny]=0;
shape_place_state[minx+2][miny]= 3;
shape_place_state[minx+1][miny+2]= 3;
}
break;
case SHAPE_7:
if(shape_place_state[minx-1][miny]==0 && shape_place_state[minx-1][miny+1]==0
&& shape_place_state[minx][miny+2]==0 && shape_place_state[minx-1][miny+2]==0 )
{
status = SHAPE_8;
shape_place_state[minx][miny]=0;
shape_place_state[minx+1][miny+2]=0;
shape_place_state[minx][miny+2]= 3;
shape_place_state[minx-1][miny+2]= 3;
}
break;
case SHAPE_8:
if(shape_place_state[minx][miny]==0 && shape_place_state[minx][miny-1]==0
&& shape_place_state[minx+1][miny-1]==0 && shape_place_state[minx+2][miny+1]==0 )
{
status = SHAPE_7;
shape_place_state[minx][miny+1]=0;
shape_place_state[minx+1][miny+1]=0;
shape_place_state[minx+1][miny-1]= 3;
shape_place_state[minx+2][miny+1]= 3;
}
break;
case SHAPE_9:
if(shape_place_state[minx+1][miny]==0 && shape_place_state[minx+1][miny+1]==0
&& shape_place_state[minx-1][miny+1]==0 && shape_place_state[minx-1][miny+2]==0
&&shape_place_state[minx-1][miny+3]==0 && shape_place_state[minx-2][miny+1]==0
&& shape_place_state[minx-2][miny+2]==0 && shape_place_state[minx-2][miny+3]==0 )
{
status = SHAPE_10;
shape_place_state[minx][miny]=0;
shape_place_state[minx][miny+2]=0;
shape_place_state[minx][miny+3]= 0;
shape_place_state[minx+1][miny+1]= 3;
shape_place_state[minx-1][miny+1]= 3;
shape_place_state[minx-2][miny+1]= 3;
}
break;
case SHAPE_10:
if(shape_place_state[minx][miny+1]==0 && shape_place_state[minx][miny+2]==0
&& shape_place_state[minx+1][miny+1]==0 && shape_place_state[minx+1][miny+2]==0
&&shape_place_state[minx+2][miny+1]==0 && shape_place_state[minx+2][miny+2]==0
&& shape_place_state[minx+2][miny-1]==0 && shape_place_state[minx+3][miny-1]==0 )
{
status = SHAPE_9;
shape_place_state[minx][miny]=0;
shape_place_state[minx+1][miny]=0;
shape_place_state[minx+3][miny]= 0;
shape_place_state[minx+2][miny-1]= 3;
shape_place_state[minx+2][miny+1]= 3;
shape_place_state[minx+2][miny+2]= 3;
}
break;
case SHAPE_12:
if(shape_place_state[minx][miny+1]==0 && shape_place_state[minx][miny+2]==0
&& shape_place_state[minx+1][miny+1]==0 && shape_place_state[minx+1][miny+2]==0 )
{
status = SHAPE_13;
shape_place_state[minx+2][miny]=0;
shape_place_state[minx+2][miny+1]=0;
shape_place_state[minx][miny+1]= 3;
shape_place_state[minx][miny+2]= 3;
}
break;
case SHAPE_13:
if(shape_place_state[minx+1][miny+1]==0 && shape_place_state[minx+1][miny+2]==0
&& shape_place_state[minx+2][miny+1]==0 && shape_place_state[minx+2][miny+2]==0 )
{
status = SHAPE_14;
shape_place_state[minx][miny]=0;
shape_place_state[minx+1][miny]=0;
shape_place_state[minx+1][miny+2]= 3;
shape_place_state[minx+2][miny+2]= 3;
}
break;
case SHAPE_14:
if(shape_place_state[minx+1][miny]==0 && shape_place_state[minx+1][miny-1]==0
&& shape_place_state[minx+2][miny-1]==0 && shape_place_state[minx+2][miny]==0 )
{
status = SHAPE_15;
shape_place_state[minx][miny]=0;
shape_place_state[minx+2][miny+1]=0;
shape_place_state[minx+1][miny]= 3;
shape_place_state[minx+1][miny-1]= 3;
}
break;
case SHAPE_15:
if(shape_place_state[minx][miny]==0 && shape_place_state[minx][miny+1]==0
&& shape_place_state[minx-1][miny]==0 && shape_place_state[minx-1][miny+1]==0 )
{
status = SHAPE_12;
shape_place_state[minx][miny+2]=0;
shape_place_state[minx+1][miny+2]=0;
shape_place_state[minx][miny]= 3;
shape_place_state[minx-1][miny]= 3;
}
break;
case SHAPE_16:
if(shape_place_state[minx][miny]==0 && shape_place_state[minx][miny-1]==0
&& shape_place_state[minx+1][miny-1]==0 && shape_place_state[minx+1][miny]==0 )
{
status = SHAPE_17;
shape_place_state[minx][miny+1]=0;
shape_place_state[minx+1][miny+1]=0;
shape_place_state[minx+1][miny-1]= 3;
shape_place_state[minx+2][miny-1]= 3;
}
break;
case SHAPE_17:
if(shape_place_state[minx][miny+1]==0 && shape_place_state[minx][miny+2]==0
&& shape_place_state[minx-1][miny+1]==0 && shape_place_state[minx-1][miny+2]==0 )
{
status = SHAPE_18;
shape_place_state[minx+1][miny+1]=0;
shape_place_state[minx+1][miny+2]=0;
shape_place_state[minx-1][miny]= 3;
shape_place_state[minx-1][miny+1]= 3;
}
break;
case SHAPE_18:
if(shape_place_state[minx+1][miny+1]==0 && shape_place_state[minx+1][miny+2]==0
&& shape_place_state[minx+2][miny+1]==0 && shape_place_state[minx+2][miny+2]==0 )
{
status = SHAPE_19;
shape_place_state[minx+1][miny]=0;
shape_place_state[minx+2][miny]=0;
shape_place_state[minx+1][miny+2]= 3;
shape_place_state[minx][miny+2]= 3;
}
break;
case SHAPE_19:
if(shape_place_state[minx+1][miny]==0 && shape_place_state[minx+1][miny+1]==0
&& shape_place_state[minx+2][miny]==0 && shape_place_state[minx+2][miny+1]==0 )
{
status = SHAPE_16;
shape_place_state[minx][miny]=0;
shape_place_state[minx][miny+1]=0;
shape_place_state[minx+2][miny+ 1]= 3;
shape_place_state[minx+2][miny+2]= 3;
}
break;
}
}
Create_Shape();
}
&& shape_place_state[minx+2][miny+1]==0 && shape_place_state[minx+2][miny+2]==0 )
{
status = SHAPE_19;
shape_place_state[minx+1][miny]=0;
shape_place_state[minx+2][miny]=0;
shape_place_state[minx+1][miny+2]= 3;
shape_place_state[minx][miny+2]= 3;
}
break;
case SHAPE_19:
if(shape_place_state[minx+1][miny]==0 && shape_place_state[minx+1][miny+1]==0
&& shape_place_state[minx+2][miny]==0 && shape_place_state[minx+2][miny+1]==0 )
{
status = SHAPE_16;
shape_place_state[minx][miny]=0;
shape_place_state[minx][miny+1]=0;
shape_place_state[minx+2][miny+ 1]= 3;
shape_place_state[minx+2][miny+2]= 3;
}
break;
}
} Create_Shape(); }
五、成果展示
|