Click here to Skip to main content
15,843,623 members
Articles / Mobile Apps / Windows Mobile


Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
31 Jul 2013CPOL3 min read 15.1K   4   4
Traditional game which becomes more interetsing.

This article is an entry in our AppInnovation Contest. Articles in this sub-section are not required to be full articles so care should be taken when voting.


This application idea is under All-in-One: Games Category.

MarbleMaze is a game where the goal is to reach the destination by keeping safe from the obstacles. It is based on Motion Sensor (accelerometers) of the device where you have to manage your motion sensor to save your ball from hole. As the level increases the complexity increases by decreasing the time to reach the ball to destination. It will make game more interesting. Anyone can challenge other player to reach destination in any fixed time and if fails then he /she lose the game.

 Image 1

Image 2 

There will be an option to compete with your regional players or international players. By the help of GPS it will search all the players within a specific range of kilometers who wants to play and by this way the user have a freedom to play with regional or international players. This is just the sample picture for explaining the game idea. A better design of game is under construction and will be uploaded soon. 

Key features  

  • More than 50 levels to play.
  • Regional and International High scores list so that user will able to know his/her rankings in a better way
  • Some useful tips to improve the rankings.
  • Better UI design
  • Handling input from accelerometer, touch, and mouse, and game controller with the Windows Runtime. 
  • Three modes: Training, Beginner, Expert

Additional features 

  • Background Music
  • Playing and mixing sound effects
  • Different color marbles.

Using the code 

I am going to use C# to develop this game.

Handling accelerometer inputs

It shows how the Update method polls the accelerometer and updates the combined input values.  

// for sensors. const float acceleromterScalingFactor = 3.5f;
if (m_accelerometer != nullptr)
    Windows::Devices::Sensors::AccelerometerReading^ reading =

    if (reading != nullptr)
        combinedTiltX += static_cast<float>(reading->AccelerationX) * acceleromterScalingFactor;
        combinedTiltY += static_cast<float>(reading->AccelerationY) * acceleromterScalingFactor;

Detecting touch and mouse inputs

When the user touches or clicks then a menu item is chosen .The m_pointQueue tracks the locations where the user touched or clicked on the screen. If  any button was pressed then it updates the game state.

// Check whether the user choose a button from the UI.
bool anyPoints = !m_pointQueue.empty();
while (!m_pointQueue.empty())
// Update the game state if any button was pressed
if (m_startGameButton.IsPressed())
if (m_highScoreButton.IsPressed())

Pause, resume, and restart functions

The game is suspended when user switches away from it and the game saves the current game state and pauses audio playback. When the app is resumed, the game resumes audio playback. When the app is closed and later restarted, the game resumes from its previous state. To support suspend and resume, Marble Maze defines the PersistentState class.

ref class PersistentState
    void Initialize(
        _In_ Windows::Foundation::Collections::IPropertySet^ m_settingsValues,
        _In_ Platform::String^ key

    void SaveBool(Platform::String^ key, bool value);
    void SaveInt32(Platform::String^ key, int value);
    void SaveSingle(Platform::String^ key, float value);
    void SaveXMFLOAT3(Platform::String^ key, DirectX::XMFLOAT3 value);
    void SaveString(Platform::String^ key, Platform::String^ string);

    bool LoadBool(Platform::String^ key, bool defaultValue);
    int  LoadInt32(Platform::String^ key, int defaultValue);
    float LoadSingle(Platform::String^ key, float defaultValue);
    DirectX::XMFLOAT3 LoadXMFLOAT3(Platform::String^ key, DirectX::XMFLOAT3 defaultValue);
    Platform::String^ LoadString(Platform::String^ key, Platform::String^ defaultValue);

    Platform::String^ m_keyName;
    Windows::Foundation::Collections::IPropertySet^ m_settingsValues;

The MarbleMaze class holds a PersistentState object. The MarbleMaze constructor initializes this object and provides the local application data store as the backing data store.

m_persistentState = ref new PersistentState();

Playing background music

if (!m_audio.m_isAudioStarted)

The OnSuspending method saves game state and suspends audio.

void MarbleMaze::OnSuspending()

Since, this application will be built from scratch and it is in the developing stage, all aspects from the concept, design (UI) and codes will be uploaded as soon as possible.  


I got this idea to develop MarbleMaze is from my last developed game for some other mobiles. I already developed this game for Qt mobiles and applying the same logic for developing games for for Windows 8 desktop with the advanced and some new features. 

As I am Microsoft Student Partner from last two years. So, i learned a lot from some MSP's and MVP's. They are helping me to design and code this. I am also taking help from MSDN site to learn and code this app.


Your comments are very valuable and helps me to rectify problems and improve my app, so please comment about this article and help me to give a valuable game to this society. Thank you so much.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer
India India
I am Nokia Developer Champion and Microsoft MSP from last two year and have an experience of developing Windows phone apps and Windows 8 apps.
Won 1st prize in the worldwide competition of Windows phone 8 app by Nokia.
Some windows phone apps :

Comments and Discussions

QuestionHow's app development going? Will you be submitting on time? Pin
Kevin Priddle24-Oct-13 6:32
professionalKevin Priddle24-Oct-13 6:32 
QuestionThanks for your submission! Pin
Kevin Priddle31-Jul-13 9:44
professionalKevin Priddle31-Jul-13 9:44 
AnswerRe: Thanks for your submission! Pin
Ayush00131-Jul-13 11:20
professionalAyush00131-Jul-13 11:20 
GeneralRe: Thanks for your submission! Pin
Kevin Priddle15-Aug-13 11:17
professionalKevin Priddle15-Aug-13 11:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.