- XNA 4.0 Game Development by Example Beginner's Guide(Visual Basic Edition)
- Kurt Jaegers
- 181字
- 2021-08-20 15:50:40
Time for action – water in the pipes
- Add a method to the
GameBoard
class to clear the water marker from all pieces:Public Sub ResetWater() Dim x, y As Integer For x = 0 To GameBoardWidth For y = 0 To GameBoardHeight boardSquares(x, y).RemoveSufix("W") Next Next End Sub
- Add a method to the
GameBoard
class to fill an individual piece with water:Public Sub FillPiece(x As Integer, y As Integer) boardSquares(x, y).AddSuffix("W") End Sub
What just happened?
The ResetWater()
method simply loops through each item in the boardSquares
array and removes the W
suffix from the GamePiece
. Similarly, to fill a piece with water, the FillPiece()
method adds the W
suffix to the GamePiece
. Recall that by having a W
suffix, the GetSourceRect()
method of GamePiece
shifts the source rectangle one tile to the right on the sprite sheet, returning the image for a pipe filled with water, instead of an empty pipe.
推薦閱讀
- Python數據分析與挖掘實戰
- Developing Mobile Games with Moai SDK
- 劍破冰山:Oracle開發藝術
- Python數據分析:基于Plotly的動態可視化繪圖
- Mastering Machine Learning with R(Second Edition)
- 數據架構與商業智能
- 基于OPAC日志的高校圖書館用戶信息需求與檢索行為研究
- SQL優化最佳實踐:構建高效率Oracle數據庫的方法與技巧
- 云原生數據中臺:架構、方法論與實踐
- INSTANT Android Fragmentation Management How-to
- MySQL DBA修煉之道
- 菜鳥學SPSS數據分析
- 企業大數據處理:Spark、Druid、Flume與Kafka應用實踐
- Python金融數據挖掘與分析實戰
- Oracle數據庫性能優化的藝術