- XNA 4.0 Game Development by Example: Beginner's Guide
- Kurt Jaegers
- 195字
- 2021-04-13 16:52:03
While it would certainly be possible to simply pile all of the game code into the Game1 class, the result would be difficult to read and manage later on. Instead, we need to consider how to logically divide the game into classes that can manage themselves and help to organize our code.
A good rule of thumb is that a class should represent a single thing or type of thing. If you can say "This object is made up of these other objects" or "This object contains these objects", consider creating classes to represent those relationships.
The Flood Control game contains a game board made up of 80 pipes. We can abstract these pipes as a class called GamePiece, and provide it with the code it needs to handle rotation and provide the code that will display the piece with a Rectangle
that can be used to pull the sprite off the sprite sheet.
The game board itself can be represented by a GameBoard class, which will handle managing individual GamePiece objects and be responsible for determining which pieces should be filled with water and which ones should be empty.
- 現代企業應用設計指南
- 剪映短視頻剪輯零基礎一本通
- 常用工具軟件案例教程
- CAXA CAD電子圖板2020工程制圖
- 中文版3ds Max 2016/VRay效果圖制作實戰基礎教程
- Dreamweaver基礎與實戰教程
- 中文版Premiere Pro CC入門教程
- Adobe創意大學InDesign產品專家認證標準教材(CS6修訂版)
- 從零開始:Indesign CC 2019設計基礎+商業設計實戰
- Altium Designer 21實戰從入門到精通
- 中文版Maya 2016基礎培訓教程
- After Effects 影視后期特效:短視頻制作實戰寶典
- Photoshop CC新媒體圖形圖像設計與制作(全彩慕課版)
- 3ds Max三維動畫制作項目式教程
- SQL編程基礎(原書第3版)