Windows Phone 7 XNA游戏开发必知

XNA Game Studio 4.0 is a game development product that Microsoft built on top of Microsoft Visual Studio 2010 and includes in the Windows Phone Developer Tools, giving game developers the power and simplicity of the C# language and the .NET libraries. XNA Game Studio 4.0 includes the XNA Framework and XNA Framework Content Pipeline:

XNA Framework – A collection of application programming interfaces (APIs) that greatly simplifies common game development tasks, such as graphical rendering and timing, audio playback, input processing, and more
XNA Framework Content Pipeline –An easy and flexible way to import three-dimensional (3D) models, textures, sounds, and other assets into your game

 

XNA Game Studio基础:

While this game will be composed of a single game screen, other games could be composed of several screens, each representing a different level. You can create multiple levels by reusing game screens while slightly altering the game logic.

一个游戏通常有三种状态:

Loading:系统读取资源,初始化与游戏相关的变量,处理其他必须的预备工作,此状态一般只在游戏生命周期中发生一次,更复杂的游戏也许需要在更多的关卡或舞台初始化时分步进行。

Update :系统更新游戏世界状态,包括计算角色实体新位置,更新它们的位置和动作,重新计算分数,处理其他相关的游戏逻辑,这些更新在游戏引擎为活动状态时经常发生。

Draw :系统将Update状态里计算出来的改变绘制到输出图形设备上,绘制在游戏引擎为活动态时经常发生。

在XNA框架中,更新和绘制舞台的频率在PC 或 Xbox 360®上是60次每秒(60帧), 在Zune®, Zune HD, 或 Windows Phone 7 设备上是最多30帧。

 

 

GameplayScreen and Game Classes

Technically, the game’s update and drawing logic is contained in the GameplayScreen class. However, the GameplayScreen does not directly handle all of the work, as some of the work is the responsibility of the relevant game classes.

Let us review some of the game classes and their intended purpose:

       Player: The player class represents the two players participating in the game and is responsible for drawing each player’s associated catapult on the screen. Two different sub-classes of the Player class actually represent each of the players. The Human class represents the human player and contains additional logic for handling input and providing visual feedback; the AI class represents the computer player and contains additional logic for automatically aiming and firing at the opposing human player.

       Catapult: The catapult class encapsulates all the drawing and logic related to one of the catapults in the game. The class keeps track of its associated catapult’s state and animates it according to that state.This class wil be used for both player and AI

       Projectile: This class represents a projectile fired by one of the catapults. It is responsible for rendering the projectile and updating its position, but not for determining whether the projectile has hit anything, because this is the job of the Catapult class.

       Animation: This helper class displays animations.

       AudioManager: This helper class plays sounds.

 

你可能感兴趣的:(windows phone)