Windows Phone 7 Game Development

Hello, my name is James Kelly. This is my first post for Flax. I’m a student in IT Carlow, doing the games development course with Ciarán and Carl. I’m here to talk about Windows Phone 7, and my experience developing for it.

I first started working with the Windows Phone during the Global Game Jam earlier this year. It’s a competition, in which you build a game in 48 hours. I joined a team making a game called Petri Paradise (I was the main programmer). The premise of the game, is to use the phone’s touchscreen to move an amoeba around the screen, collecting sugar cubes while avoiding viruses, bacteria and salt which could kill you. Once 4 pieces of salt are collected, the amoebas split producing two amoebas. After the jam, I continued to work on the game hoping to put it up on the Windows Phone Marketplace.


I used Microsoft’s XNA in C# for this project. I found it easy to pick up, but it still took work.
Animations were quickly done, using a single image containing all the animation states and SpriteBatch. Using a simple animation class to iterate a rectangle 32 pixel across the image, the SpriteBatch only draws what’s in the rectangle you give it (similar to CSS spriting).


The touchscreen was easy to work with. The TouchPanel class provides methods for retrieving all touchscreen related information. TouchPanel is used to get the current state of the touchscreen, which returns a TouchCollection, which funnily enough provides a collection of touch information like location, and pressure on that part of the screen. We used a foreach loop to iterate through all the touch locations, in TouchCollection for multitouch. The TouchLocation object provides singular information on a touch location. In particular, it provides a position vector for me make the move formula to push the amoeba.


After GGJ, I had the basic game going with sprite animations, and not much else. I first had to install the tools needed to work on the phone available on AppHub. These tools provided me with an emulator (not being fortunate enough to own a windows phone myself). A few things I figured out after I returned home, is how Windows Phone 7 runs. It runs five methods: initialize, where variables are set up, then LoadContent where audio clips, sprites, etc , can be loaded from the content file. Then it loops through update, where the main bulk of your code goes, and Draw, which handles drawing content to the screen.

Windows Phone 7 game in action

Windows Phone 7 game in action

I had problems, though; rotation only recently started working with accelerometer. Before that, I had rotated graphics by display orientation, where I used the graphics device to check its orientation. The method SupportedOrientations sets and gets orientation if there is any change in the phone’s orientation. I then checked the orientation of the phone’s presentation parameters for a switch between horizontal and vertical, and I rotated all the entities in the game by ninety degrees, switching x and y position. A small side note, maths uses radians on a Windows Phone. I lost a lot of time before realising that.


A few problems: while trying to draw text to screen, I didn’t realise that the font variable must be provided to draw to screen. A font variable must be set up by loading a spritefont from the content file. A spritefont is an XML sheet where font information can be changed, like size, font-type, spacing etc.


Overall, I’m finding that developing for the WP7 is easy to pick up and work with; the emulator is providing a decent substitute for the real thing. I am going to try to get a Wiimote to emulate the phones accelerometer. I plan to complete the game soon, and get it  up on the Windows Phone 7 Marketplace. I’ll post about how that turns out. Thanks for reading.

About the Author

James Kelly

I am a student at IT Carlow studying Games development. I really enjoy programming and I love to challenge myself, learning new languages and general putting what i have learnt to the test,but mostly i spend my time planning for the zombie Apocalypse it's real, it's coming.

Visit Website


  1. Keith Cully June 27, 2011

    Whats up lads. Just said I would let you know that I’m currently finalizing my WP7 game and would be happy to share solutions to some of the problems encountered along the way.