⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 russiangamedlg.cpp

📁 一个好玩的俄罗斯方块游戏
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                    }
			}
            else if(board.piecepos == 2)
			{
                if(board.piecex <= 8)
                    if(board.square[board.piecex + 2][board.piecey] == 0 && board.square[board.piecex +2][board.piecey + 1]== 0 && board.square[board.piecex+1][board.piecey - 1] == 0)
					{
                        board.square[board.piecex +2][board.piecey] = 1;
                        board.square[board.piecex +2][board.piecey +1] = 1;
                        board.square[board.piecex+1][board.piecey - 1] = 1;
                        board.square[board.piecex + 1][board.piecey + 1] = 0;
                        board.square[board.piecex][board.piecey-1] = 0;
                        board.square[board.piecex][board.piecey] = 0;
                        board.piecex = board.piecex + 1;
					}
			}
			break;
        case 6:
			if(board.piecepos == 1)
			{
                if(board.piecex <= 8)
                    if(board.square[board.piecex + 2][board.piecey] == 0 && board.square[board.piecex + 1][board.piecey - 1]== 0)
					{
                        board.square[board.piecex + 2][board.piecey]=1;
                        board.square[board.piecex + 1][board.piecey-1] = 1;
                        board.square[board.piecex][board.piecey-1] = 0;
                        board.square[board.piecex -1][board.piecey] = 0;
                        board.piecex = board.piecex + 1;
                    }
			}
            else if(board.piecepos == 2)
			{
                if(board.piecex <= 8)
                    if(board.square[board.piecex + 1][board.piecey - 1]== 0 && board.square[board.piecex +2][board.piecey]== 0 && board.square[board.piecex + 1][board.piecey + 1]== 0)
					{
                        for(i = board.piecey - 1;i<=board.piecey + 1;i++)
						{
                            board.square[board.piecex + 1][i] = 1;
                            board.square[board.piecex][i] = 0;
                        }
                        board.square[board.piecex+2][board.piecey] = 1;
                        board.piecex = board.piecex + 1;
                    }
			}
            else if(board.piecepos== 3)
			{
                if(board.piecex <= 8)
                    if(board.square[board.piecex + 2][board.piecey]== 0 && board.square[board.piecex+1][board.piecey + 1]== 0)
					{
                        board.square[board.piecex + 2][board.piecey] = 1;
                        board.square[board.piecex+1][board.piecey + 1]= 1;
                        board.square[board.piecex - 1][board.piecey] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.piecex = board.piecex + 1;
                    }
			}
            else if(board.piecepos == 4)
			{
                if(board.piecex <= 9)
                    if( board.square[board.piecex + 1][board.piecey - 1] == 0 && board.square[board.piecex +1][board.piecey]== 0 && board.square[board.piecex + 1][board.piecey + 1]== 0)
					{
                        board.square[board.piecex + 1][board.piecey - 1] = 1;
                        board.square[board.piecex +1][board.piecey] = 1;
                        board.square[board.piecex + 1][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.square[board.piecex-1][board.piecey] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.piecex = board.piecex + 1;
                    }
			}
			break;
        case 7:
            if(board.piecex <= 8)
                if( board.square[board.piecex +2][board.piecey - 1]== 0 && board.square[board.piecex +2][board.piecey]== 0)
				{
                    board.square[board.piecex +2][board.piecey - 1] = 1;
                    board.square[board.piecex +2][board.piecey] = 1;
                    board.square[board.piecex ][board.piecey - 1] = 0;
                    board.square[board.piecex ][board.piecey] = 0;
                    board.piecex = board.piecex + 1;
                }
			break;
	}
	InvalidateRect(&rect,FALSE);
	return;

}

void CRussianGameDlg::roatepiece()
{
	int curpiece;
	curpiece=board.curpiece;
	switch (curpiece)
	{
	case 1:
            if(board.piecepos== 1)
			{
				if(board.piecey > 1 && board.piecey <= 16)
                    if (board.square[board.piecex][board.piecey - 1]== 0 && board.square[board.piecex][board.piecey + 1]== 0 && board.square[board.piecex][board.piecey + 2]== 0)
					{
                        board.square[board.piecex - 1][board.piecey] = 0;
                        board.square[board.piecex + 1][board.piecey] = 0;
                        board.square[board.piecex + 2][board.piecey] = 0;
                        board.square[board.piecex][board.piecey - 1] = 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey + 2] = 1;
                        board.piecepos = 2;
                    }
			}
            else if(board.piecepos ==2)
			{
                if (board.piecex > 1 && board.piecex <= 8 )
                    if(board.square[board.piecex - 1][board.piecey]== 0 && board.square[board.piecex + 1][board.piecey] == 0 && board.square[board.piecex + 2][board.piecey]== 0)
					{
                        board.square[board.piecex - 1][board.piecey] = 1;
                        board.square[board.piecex + 1][board.piecey] = 1;
                        board.square[board.piecex + 2][board.piecey] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.square[board.piecex][board.piecey + 2] = 0;
                        board.piecepos = 1;
                    }
			}
			break;
	case 2:
            if(board.piecepos == 1)
			{
                if(board.piecey <= 17)
                    if (board.square[board.piecex][board.piecey - 1] == 0 && board.square[board.piecex + 1][board.piecey - 1] == 0 && board.square[board.piecex][board.piecey + 1]== 0)
					{
                        board.square[board.piecex][board.piecey - 1] = 1;
                        board.square[board.piecex + 1][board.piecey - 1] = 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex - 1][board.piecey] = 0;
                        board.square[board.piecex - 1][board.piecey - 1] = 0;
                        board.square[board.piecex + 1][board.piecey] = 0;
                        board.piecepos = 2;
                    }
			}
            else if(board.piecepos == 2)
			{
                if(board.piecex > 1)
                    if(board.square[board.piecex - 1][board.piecey]== 0 && board.square[board.piecex + 1][board.piecey] == 0 && board.square[board.piecex + 1][board.piecey + 1]== 0)
					{
                        board.square[board.piecex - 1][board.piecey] = 1;
                        board.square[board.piecex + 1][board.piecey] = 1;
                        board.square[board.piecex + 1][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.square[board.piecex + 1][board.piecey - 1] = 0;
                        board.piecepos = 3;
                    }
			}
            else if(board.piecepos == 3)
			{
                if(board.piecey > 1)
                    if(board.square[board.piecex][board.piecey - 1] == 0 && board.square[board.piecex][board.piecey + 1] == 0 && board.square[board.piecex - 1][board.piecey + 1] == 0)
					{
                        board.square[board.piecex][board.piecey - 1] = 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex - 1][board.piecey + 1] = 1;
                        board.square[board.piecex - 1][board.piecey] = 0;
                        board.square[board.piecex + 1][board.piecey] = 0;
                        board.square[board.piecex + 1][board.piecey + 1] = 0;
                        board.piecepos = 4;
                    }
			}
            else if(board.piecepos == 4)
			{
                if(board.piecex < 10)
                    if(board.square[board.piecex + 1][board.piecey]== 0 && board.square[board.piecex - 1][board.piecey]== 0 && board.square[board.piecex - 1][board.piecey - 1] == 0)
					{
                        board.square[board.piecex + 1][board.piecey] = 1;
                        board.square[board.piecex - 1][board.piecey] = 1;
                        board.square[board.piecex - 1][board.piecey - 1] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.square[board.piecex - 1][board.piecey + 1] = 0;
                        board.piecepos = 1;
                    }
			}
			break;
	case 3:
            if(board.piecepos == 1)
			{
                if(board.piecey <=17)
                    if(board.square[board.piecex][board.piecey - 1]== 0 && board.square[board.piecex + 1][board.piecey + 1] == 0 && board.square[board.piecex][board.piecey + 1] == 0)
					{
                        board.square[board.piecex][board.piecey - 1] = 1;
                        board.square[board.piecex + 1][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex - 1][board.piecey] = 0;
                        board.square[board.piecex + 1][board.piecey - 1] = 0;
                        board.square[board.piecex + 1][board.piecey] = 0;
                        board.piecepos = 2;
                    }
			}
            else if(board.piecepos==2)
			{
                if(board.piecex > 1)
                    if(board.square[board.piecex - 1][board.piecey] == 0 && board.square[board.piecex + 1][board.piecey]== 0 && board.square[board.piecex - 1][board.piecey + 1] == 0)
					{
                        board.square[board.piecex - 1][board.piecey] = 1;
                        board.square[board.piecex + 1][board.piecey] = 1;
                        board.square[board.piecex - 1][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.square[board.piecex + 1][board.piecey + 1] = 0;
                        board.piecepos = 3;
                    }
			}
            else if(board.piecepos == 3)
			{
                if(board.piecey > 1)
                    if(board.square[board.piecex][board.piecey - 1]== 0 && board.square[board.piecex][board.piecey + 1] == 0 && board.square[board.piecex - 1][board.piecey - 1] ==0)
					{
                        board.square[board.piecex][board.piecey - 1] = 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex - 1][board.piecey - 1] = 1;
                        board.square[board.piecex - 1][board.piecey] = 0;
                        board.square[board.piecex + 1][board.piecey] = 0;
                        board.square[board.piecex - 1][board.piecey + 1] = 0;
                        board.piecepos = 4;
					}
			}
            else if(board.piecepos == 4)
			{
                if(board.piecex < 10)
                    if(board.square[board.piecex + 1][board.piecey] == 0 && board.square[board.piecex - 1][board.piecey] == 0 && board.square[board.piecex + 1][board.piecey - 1] ==0)
					{
                        board.square[board.piecex + 1][board.piecey] = 1;
                        board.square[board.piecex - 1][board.piecey] = 1;
                        board.square[board.piecex + 1][board.piecey - 1] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.square[board.piecex - 1][board.piecey - 1] = 0;
                        board.piecepos = 1;
                    }
			}
			break;
	case 4:
            if(board.piecepos == 1)
			{
                if(board.piecey < 18)
                    if(board.square[board.piecex + 1][board.piecey - 1]== 0 && board.square[board.piecex][board.piecey + 1] == 0 )
					{
                        board.square[board.piecex + 1][board.piecey - 1] = 1;
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.square[board.piecex - 1][board.piecey - 1] = 0;
                        board.piecepos = 2;
                    }
			}
            else if(board.piecepos == 2)
			{
                if(board.piecex > 1)
                    if(board.square[board.piecex][board.piecey - 1]== 0 && board.square[board.piecex - 1][board.piecey - 1] == 0 )
					{
                        board.square[board.piecex][board.piecey - 1] = 1;
                        board.square[board.piecex - 1][board.piecey - 1] = 1;
                        board.square[board.piecex + 1][board.piecey - 1] = 0;
                        board.square[board.piecex][board.piecey + 1] = 0;
                        board.piecepos = 1;
					}
			}
			break;
	case 5:
            if(board.piecepos == 1)
			{
                if(board.piecey < 18 )
                    if(board.square[board.piecex + 1][board.piecey] == 0 && board.square[board.piecex + 1][board.piecey + 1] == 0 )
					{
                        board.square[board.piecex + 1][board.piecey] = 1;
                        board.square[board.piecex + 1][board.piecey + 1] = 1;
                        board.square[board.piecex - 1][board.piecey] = 0;
                        board.square[board.piecex + 1][board.piecey - 1] = 0;
                        board.piecepos = 2;
                    }
			}
            else if(board.piecepos == 2)
			{
                if(board.piecex > 1 )
                    if(board.square[board.piecex - 1][board.piecey] == 0 && board.square[board.piecex + 1][board.piecey - 1] == 0)
					{
                        board.square[board.piecex - 1][board.piecey] = 1;
                        board.square[board.piecex + 1][board.piecey - 1] = 1;
                        board.square[board.piecex + 1][board.piecey] = 0;
                        board.square[board.piecex + 1][board.piecey + 1] = 0;
                        board.piecepos = 1;
                    }
			}
			break;
	case 6:
           if(board.piecepos == 1)
		   {
                if(board.piecey <= 17)
                    if(board.square[board.piecex][board.piecey + 1] == 0 )
					{
                        board.square[board.piecex][board.piecey + 1] = 1;
                        board.square[board.piecex - 1][board.piecey] = 0;
                        board.piecepos = 2;
                    }
		   }
            else if(board.piecepos == 2)
			{
                if(board.piecex > 1)
                    if(board.square[board.piecex - 1][board.piecey] == 0)
					{
                        board.square[board.piecex - 1][board.piecey] = 1;
                        board.square[board.piecex][board.piecey - 1] = 0;
                        board.piecepos = 3;
					}
			}
            else if(board.piecepos == 3)
			{
                if(board.piecey > 1)
                    if(board.square[board.piecex][board.piecey - 1] == 0)
					{
                        board.square[board.piecex][board.piecey - 1] 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -