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

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.

主站蜘蛛池模板: 获嘉县| 衡南县| 丰顺县| 海安县| 康保县| 通许县| 荣成市| 永昌县| 塔城市| 手游| 珠海市| 景东| 渑池县| 迁安市| 新宾| 亳州市| 高密市| 囊谦县| 宁波市| 古浪县| 彭阳县| 西和县| 陇川县| 蒲城县| 密云县| 汽车| 云林县| 新巴尔虎左旗| 石泉县| 衡东县| 柘城县| 乌拉特中旗| 呼玛县| 绥棱县| 元阳县| 柳州市| 绩溪县| 澄城县| 巴东县| 托里县| 甘南县|