官术网_书友最值得收藏!

Time for action – generating fading pieces

  1. In the Game1 class, modify the CheckScoringChain() method by adding the following call inside the for each loop, before the square is set to Empty:
    _gameBoard.AddFadingPiece(
        CInt(thisPipe.X),
        CInt(thisPipe.Y),
        _gameBoard.GetSquare(
            CInt(thisPipe.X),
            CInt(thisPipe.Y)))

What just happened?

Adding fading pieces is simply a matter of getting the type of piece currently occupying the square that we wish to remove (before it is replaced with an empty square) and adding it to the FadingPieces dictionary. We need to use the CInt typecasts because the thisPipe variable is a Vector2 value, which stores its X and Y components as Singles.

Falling pieces

Falling pieces are added to the game board in two possible locations: from the FillFromAbove() method when a piece is being moved from one location on the board to another, and in the GenerateNewPieces() method when a new piece falls in from the top of the game board.

主站蜘蛛池模板: 阳谷县| 紫阳县| 夏河县| 邻水| 祁连县| 寿宁县| 张家港市| 嘉黎县| 吉木萨尔县| 镇江市| 三河市| 米泉市| 张家港市| 舟山市| 上虞市| 宝清县| 方山县| 平罗县| 广南县| 武穴市| 黄龙县| 富蕴县| 内黄县| 昌图县| 商洛市| 深圳市| 鄂温| 渭源县| 抚宁县| 南丰县| 镇原县| 太仓市| 孝昌县| 三江| 昌乐县| 巴彦县| 雷州市| 涿州市| 射阳县| 江西省| 光山县|