2. Learning Objectives Why Windows Phone 7? What is XNA? XNA Game Programming Basics Dream. Build. Play. Next Steps… “ The hardest thing about creating your first game is finishing it. – @OwenGoss
12. Input TouchCollection 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; }}
13. Tombstoning For 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.
32. Trial Mode An 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;
36. Game Feedback This 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();
Welcome out to the Windows Phone Developer Briefing:[Intro]- Cory Fowler- ObjectSharp- Games Hobbyist
Consumer facing PhoneXbox Live IntegrationFamiliar Development StorySilverlightXNAC# or VB.NET
Brings Managed Code to Games DevelopmentCross Platform Development between ZuneWindows PhoneXbox360Windows 7All on One Code Base
The XNA Framework like most games runs on a Game LoopInitialization ConstructorLoadContentLoad up main graphics required for gameplayThe LoopUpdateUser input Collection and Calculation of Sprite PositioningDrawRe-Draw the sprites on the ScreenUnloadContentGarbage Collection and Freeing up resources
Open Visual StudioCreate new Game ProjectReview Code Blocks for The Loop
Image files which are loaded into a game.There is a good chance that your game with be someone in the ballpark of 60-70% Textures.Your game can only take up 90MB of RAM while running.
Sprites are images that move independently to the rest of the game.A Sprites position and other attributes are maintained in a instance of a class or struct.
Add in two Textures and load them onto the screen with SpriteBatch.Draw
Currently the only Sensor supported by the Phones APIs is the Accelerometer.
Make sure that your Architecture is part of your prototype.Plan for when the phone is Connected…
Plan for when the Phone is Disconnected…
Knowing the Architecture Story of your Game will aid you in Laying out the Flow of your Screens.You can also find the Game State Management Project Template in the Extension Manager.
Open AlienGame [Start Here] and create Pause ScreenInherit MenuScreenCreate MenuEntry for ResumeCreate MenuEntry for QuitAdd to MenuEntries Collection
Enums are great for tracking state, which in a game there is a LOT of state.Enumsalso help make your code easier to ready, which allows you to use your brainpower for the Math.Smaller Operating cost than using Strings.
Boxing is a processing intense operation.
Arrays – Memory Allocation is going to be consistentList – Basically any hand rolled POCOAvoid - boxed
structs are optimal for objects up to 16bytes in size and are good candidates for using arrays.Classes are a good choice if the size of the object is going to fluxuaterepetetively
The Typical response time of this method is 6 MillisecondsShould only be called during Initialize and Activated