Пример #1
0
 /*移动*/
 public bool down()
 {
     //检测是否可以下移
     if (GameField.isEmpty(square1.location.X / squareSize, square1.location.Y / squareSize + 1) &&
         GameField.isEmpty(square2.location.X / squareSize, square2.location.Y / squareSize + 1) &&
         GameField.isEmpty(square3.location.X / squareSize, square3.location.Y / squareSize + 1) &&
         GameField.isEmpty(square4.location.X / squareSize, square4.location.Y / squareSize + 1))
     {
         Erase(GameField.winHandle);
         square1.location = new Point(square1.location.X, square1.location.Y + squareSize);
         square2.location = new Point(square2.location.X, square2.location.Y + squareSize);
         square3.location = new Point(square3.location.X, square3.location.Y + squareSize);
         square4.location = new Point(square4.location.X, square4.location.Y + squareSize);
         Draw(GameField.winHandle);
         return(true);
     }
     else  //如果不能下移了
     {
         GameField.stopSquare(square1, square1.location.X / squareSize, square1.location.Y / squareSize);
         GameField.stopSquare(square2, square2.location.X / squareSize, square2.location.Y / squareSize);
         GameField.stopSquare(square3, square3.location.X / squareSize, square3.location.Y / squareSize);
         GameField.stopSquare(square4, square4.location.X / squareSize, square4.location.Y / squareSize);
         return(false); //表示可以弹出下一个block了
     }
 }