Escape the fear of writing XNA games for Windows Phone 7.5 and XBOX 360
- Posted: Apr 16, 2012 at 6:00 AM
- 9,391 Views
- 4 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
This week we're going to be doing a gaming theme, mostly focusing on getting started writing games (Pretty much in the hope that all of you that aren't already writing games, start doing so and thereby give us something to blog about here... see how that works? I'm tricksy hobbit/man/guy/what-ever...)
We kick off the week with a tutorial, from start to gaming, on writing an XNA Windows Phone 7.1(5) game. One of the main points I'd like to stress in this tutorial is that you don't have to be afraid of writing a game. It's not as scary or hard as you might think...
In this tutorial we are going through the process of creating a simple game from A to Z using Visual Studio 2010 and the Windows Phone 7.1 SDK – Targeting Windows Phone 7.5.
This game was created during a presentation and took about 45 minutes, and patched as the session went on by feedback from the audience. I just documented the process and shared it on this blog.
First of all, if you haven’t done so yet – you will need to download the Windows Phone SDK.
1. Designing the game
The first thing you should do when creating a game is to come up with an idea, story and how you should go through that story. It’s important to be able to explain the game in one sentence – if you can’t, the players/gamers/consumers will have trouble understanding the game. If you can, it will be much easier to market and sell the game!
2. Creating the graphics
Most games require some graphics. In this game I want to have a playfield that represents the floor in a ghost house, a ghost, a player, some text that display high scores and some dot’s that show where I just walked (path).
3. Game logic
Next we should think how we should play the game, what’s the logic, how is the enemies moving, how should the player move and so on.
4. Implementing the game
The games classes we will implement
Be sure do download the source for the applications so you can follow the implementations. Or you can follow the steps below and create the game as we go, but not all details will be covered.
At this point the post takes you through the development process and explaining the major code points.
As an added bonus, not only is the source for this game available (click through for the download links), but the author has also already ported it to the XBOX 360 (and made that source available too!)
I just quickly ported the game Escape (created in this tutorial) to Xbox 360. The code is quite similar with two exceptions:
- I had to handle the safe limit zone and various screen resolutions
- I changed the controller from being touch-based to GamePad-based, and also considering that the player might use a gamepad that is either player one, two, three of four.
I also removed the online high score system since when it comes to the Xbox 360, we have to use a completely different approach when it comes to online storage.
If you already know C# and are thinking about writing XNA games for Windows Phone 7 or the XBOX 360, this tutorial would be a great place to start...