Wednesday, December 21, 2011

My first Windows Phone 7 Game

As I wrote in my last post my first windows phone app was a game called Simon aka Saimon or here in Switzerland better known as Senso. It's a classic brain game from the 80ies and everybody in my age will know the old version from MB I guess.

The goal of the game is to repeat the color sequences as long as you can. You will start with one color and with every right reputation one additional color will be added.

And this is what the game looks like.

To make the game more interesting I added different color schemas. You got the classic design in a nice Windows Phone Metro Style look, a dark and a bright color schema which are harder to play.
To make the game more addicting and more fun to play I added a statistic and you and your friends can set up a competition.

And now we take a look at the programming. Was there anything exciting? At the begining everything was straight forward. Take four buttons, setup some storyboards, ...
Then I wanted to add four sounds for the button clicks. In a Silverlight App for WP7 there is the media tag for a background sound. After a short google session it was clear not to use the media tag. It's not right thing for my needs, playing different sounds in a short sequence.
What I need is the SoundEffect class from the Microsoft.Xna.Framework.Audio. To make this sounds work you also need the FrameworkDispatcher class.
So first thing to do is to add a reference to the Microsoft.Xna.Framework.dll. Then you got access to all the classes you need. For the rest take a look at the Sound Sample.

After all, if you think you like the game get it here. Or if you not sure yet, wait for the trail version that is already submitted to Microsoft.

No comments: