41
Blog: http://blog.syntaxc4.net

XNA On Windows Phone 7

Embed Size (px)

DESCRIPTION

Learn how to develop XNA Games for Windows Phone 7

Citation preview

Blog: http://blog.syntaxc4.net

Learning ObjectivesXNA Game Programming Basics

What is XNA?

Why Windows Phone 7?

Dream. Build. Play.

Next Steps…

“ The hardest thing about creating your first game is finishing it. – @OwenGoss

Why Windows Phone

7?

What is XNA?

** Disclaimer: Items are not to scale.

The Basics

Focus on gameplay! There's no point in having the latest, greatest tech in a game if the gameplay is terrible. - @Justin_Hebert

The Game LoopInitialize() LoadContent()

UnloadContent()

The Loop

Update() Draw()

Demo #1: Stepping into the

Game Loop

Textures

Sprites

Demo #2:Adding Textures

and Sprites

Sensorsusing Microsoft.Devices.Sensors;

AccelerometerReadingEventArgs accelState;Accelerometer _accelerometer = new Accelerometer();if (_accelerometer.State == SensorState.Ready){    _accelerometer.ReadingChanged += (s, e) =>    {           accelState = e;    };    _accelerometer.Start();}

InputTouchCollection touchState = TouchPanel.GetState();

 //interpret touch screen pressesforeach (TouchLocation location in touchState){     switch (location.State)     {        case TouchLocationState.Pressed:             buttonTouched = true;             break;        case TouchLocationState.Moved:             break;        case TouchLocationState.Released:             break;    }}

TombstoningFor games, when the Back button is pressed during gameplay, the game can choose to present a pause context menu or dialog or navigate the user to the prior menu screen. Pressing the Back button again while in a paused context menu or dialog closes the menu or dialog.

Dream. Build. Play.

Dream

The Idea

It could be new…

…Or a new Twist

We’re going to borrow an Idea

Build

Alien Game Lab

URL: http://hmbl.me/4BSBKO

Three Pillars of Game Development

Prototype

Performance

Polish

Prototyping

Architecture

Connected

Architecture

Disconnected

Game State Management

URL: http://hmbl.me/4BSHGB

Demo #4:Creating a

Screen

Performance&

Code Quality

Enums are Handy

Avoid Boxing

Use Generics

Array vs List

struct vs class

Trial ModeAn application must not invoke either of the Trial APIs in a tight loop. For example, a game application must not invoke either of the Trial APIs while in a game loop. The API should be called infrequently and the value returned should be cached

bool isTrial = Guide.IsTrialMode;

Demo #5:Trial Mode

Polishing

Game Feedback

using Microsoft.Devices;

VibrateController.Default.Start(TimeSpan.FromSeconds(1));

Game FeedbackThis requirement does not apply to applications that play sound effects through the Microsoft.Xna.Framework.Audio.SoundEffect class, as sound effects will be mixed with the MediaPlayer. The SoundEffect class should not be used to play background music.

SoundEffect alienFired = Content.Load<SoundEffect>("Tank_Fire");

alienFired.Play();

Play

Side Load

Market Place

http://create.msdn.com

Next Steps…Topic URL

Sign up for App Hub http://hmbl.me/4BTK6G

Download Windows Phone Tools http://hmbl.me/4BTH3Z

App Certification Requirements http://hmbl.me/4BTIYK

XNA on Windows Phone 7 http://hmbl.me/4BTBMM

Analysis & Optimization of XNA http://hmbl.me/4BTFPR

Sprite Sheet Sample http://hmbl.me/4BU9N5

Shawn Hargreaves Blog http://hmbl.me/4BUIDM

Q & A

Sorry, I don’t give out Game Ideas