- XNA 4 3D Game Development by Example:Beginner's Guide
- Kurt Jaegers
- 145字
- 2021-08-05 18:55:26
Time for action – customizing the Initialize() method
Add the following code snippet to the Ini
tialize()
method before base:Initialize()
:
playerScore = 0;
What just happened?
The only initialization we need to do is set the player's score to zero. Even this initialization is not strictly necessary, as zero is the default value for an int
variable, but it is a good practice not to assume that this work will have been done for us.
Tip
Initialize() versus LoadContent()
In practice, much of a game's initialization actually takes place in the LoadContent()
method , which we will discuss next, instead of the Initialize()
method. This is because many times the items we want to initialize require content assets in order to be properly created. One common use for the Initialize()
method is to set the initial display area (resolution) and switch into full screen mode.
- 從零開始學Hadoop大數據分析(視頻教學版)
- iOS and OS X Network Programming Cookbook
- Sybase數據庫在UNIX、Windows上的實施和管理
- Learning Proxmox VE
- 數據庫設計與應用(SQL Server 2014)(第二版)
- 圖數據實戰:用圖思維和圖技術解決復雜問題
- 信息學競賽寶典:數據結構基礎
- 探索新型智庫發展之路:藍迪國際智庫報告·2015(下冊)
- 淘寶、天貓電商數據分析與挖掘實戰(第2版)
- Construct 2 Game Development by Example
- 大數據分析:數據倉庫項目實戰
- Mastering LOB Development for Silverlight 5:A Case Study in Action
- SQL Server 2012實施與管理實戰指南
- Oracle高性能SQL引擎剖析:SQL優化與調優機制詳解
- 大數據數學基礎(Python語言描述)