Introduction
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.
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.
if (m_accelerometer != nullptr)
{
Windows::Devices::Sensors::AccelerometerReading^ reading =
m_accelerometer->GetCurrentReading();
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.
bool anyPoints = !m_pointQueue.empty();
while (!m_pointQueue.empty())
{
UserInterface::GetInstance().HitTest(m_pointQueue.front());
m_pointQueue.pop();
}
if (m_startGameButton.IsPressed())
{
SetGameState(GameState::PreGameCountdown);
m_startGameButton.SetPressed(false);
}
if (m_highScoreButton.IsPressed())
{
SetGameState(GameState::HighScoreDisplay);
m_highScoreButton.SetPressed(false);
}
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
{
public:
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);
private:
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();
m_persistentState->Initialize(ApplicationData::Current->
Playing background music
if (!m_audio.m_isAudioStarted)
{
m_audio.Start();
}
The OnSuspending
method saves game state and suspends audio.
void MarbleMaze::OnSuspending()
{
SaveState();
m_audio.SuspendAudio();
}
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.
Background
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.
Request
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.
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 : http://www.windowsphone.com/en-us/search?q=ayush_kedia