- XNA 4.0 Game Development by Example: Beginner's Guide
- Kurt Jaegers
- 229字
- 2021-04-13 16:52:11
- Modify the
FillFromAbove()
method of the GameBoard class by adding a call to generate falling pieces right before therowLookup = -1;
line:AddFallingPiece(x, y, GetSquare(x, y), GamePiece.PieceHeight *(y-rowLookup));
- Update the
GenerateNewPieces()
method by adding the following call right after theRandomPiece(x,y)
line:AddFallingPiece(x, y, GetSquare(x, y), GamePiece.PieceHeight * GameBoardHeight);
When FillFromAbove()
moves a piece downward, we now create an entry in the FallingPieces
dictionary that is equivalent to the newly moved piece. The vertical offset is set to the height of a piece (40 pixels) times the number of board squares the piece was moved. For example, if the empty space was at location 5,5 on the board, and the piece above it (5,4) is being moved down one block, the animated piece is created at 5,5 with an offset of 40 pixels (5-4 = 1, times 40).
When new pieces are generated for the board, they are added with an offset equal to the height (in pixels) of the game board, determined by multiplying the GamePiece.PieceHeight
value by the GameBoardHeight
. This means they will always start above the playing area and fall into it.
- 性能測試從零開始
- Excel圖表與表格實戰技巧精粹
- Photoshop CC 2018實用教程
- Puppet 2.7 Cookbook
- 中文版Illustrator CC 2018基礎培訓教程
- 3ds Max 2015中文版從入門到精通
- SPSS統計分析
- Photoshop CC摳圖+修圖+調色+合成+特效實戰視頻教程
- 中文版After Effects 2022基礎教程
- Microsoft Azure: Enterprise Application Development
- CakePHP Application Development
- 剪映短視頻剪輯從入門到精通:宣傳短片+電商視頻+產品廣告+活動慶典
- 手機/電腦雙平臺剪映短視頻后期編輯從新手到高手
- PHP and MongoDB Web Development Beginner's Guide
- CorelDRAW X6平面設計與制作案例教程