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

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.

主站蜘蛛池模板: 灌阳县| 高平市| 溧水县| 岳普湖县| 鸡西市| 海安县| 临颍县| 应用必备| 锦州市| 凤阳县| 昭觉县| 富宁县| 体育| 栾川县| 蚌埠市| 离岛区| 东城区| 通州区| 南丹县| 中江县| 砀山县| 宁河县| 略阳县| 博野县| 肥城市| 桃江县| 白银市| 兴和县| 囊谦县| 大渡口区| 中江县| 平陆县| 新沂市| 高安市| 龙门县| 休宁县| 平武县| 上蔡县| 奉贤区| 河池市| 介休市|