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

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.

主站蜘蛛池模板: 丰台区| 武隆县| 福建省| 漳州市| 六盘水市| 汶川县| 大方县| 新民市| 三台县| 霍林郭勒市| 星座| 叙永县| 克什克腾旗| 屯昌县| 松桃| 南靖县| 庆云县| 瑞丽市| 土默特右旗| 淄博市| 札达县| 凌源市| 民乐县| 二连浩特市| 廉江市| 刚察县| 湟源县| 航空| 微博| 灵丘县| 卫辉市| 利辛县| 遂平县| 桐梓县| 原阳县| 石台县| 柯坪县| 介休市| 白河县| 江川县| 营山县|