- 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.
- Visual Studio 2015 Cookbook(Second Edition)
- 分布式數據庫系統:大數據時代新型數據庫技術(第3版)
- Libgdx Cross/platform Game Development Cookbook
- 云計算服務保障體系
- 大數據Hadoop 3.X分布式處理實戰
- 一個64位操作系統的設計與實現
- 深入淺出Greenplum分布式數據庫:原理、架構和代碼分析
- AI時代的數據價值創造:從數據底座到大模型應用落地
- 計算機應用基礎教程上機指導與習題集(微課版)
- SQL Server 2012數據庫管理教程
- Hadoop集群與安全
- MySQL技術內幕:SQL編程
- 聯動Oracle:設計思想、架構實現與AWR報告
- Doris實時數倉實戰
- 碼上行動:利用Python與ChatGPT高效搞定Excel數據分析