Click here to Skip to main content
Click here to Skip to main content

Marbles

, 24 Apr 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
A strategy game that you must think twice before you move because you can't go back. Face 14 Levels of exciting.

Sample Image - Marbles.jpg

Introduction

Marbles is a strategy game for smart devices to the smart users. The idea is taken from an old game called Marbles Deluxe.

How to play

The goal of the game is to move the ball to get all jewels then go to the target block. While doing this, you can switch pairs of blocks to make space for the ball.

Click on a block to select it then click it again to move the ball to this block, or click another block to switch the two blocks.

Some blocks cannot be switched like the target and the jewels. Some blocks will kill you like the skull block. Some blocks will move you like the arrows blocks.

Take care blocks vanish after you move on them. You will not be able to go backward. Except white blocks, you can hit them two times before they vanish.

Implementation

The code is readable and contains comments that don't need explanation except for some bug fixes. The Game contains two classes:

Marbles: which is the main form of the application and has all the interactivity of the game and its rules.

Board: which has the information of the game and how to save it and load it.

Graphics

Images for the game were created using 3D studio MAX 5. I'm a graphics designer too.

To create more levels

You can create your own editor for the game levels on a smart device or a normal windows application. To create the editor you will use the Board class and fill it with numbers of the images that are provided in the source project. Then save the file by calling the function void Board.Save(string file).

This is the code for saving the level after editing:

void Save(string file)
{
 StreamWriter r=new StreamWriter(file);
 r.WriteLine(Width.ToString());
 r.WriteLine(Height.ToString());

 for(int y=0;y<Height;y++)
 {
  for(int x=0;x<Width;x++)
  {
   r.WriteLine(Data[x,y].ToString());
  }
 }
 r.Close();
}

If you like it, please vote for it.

License

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

Share

About the Author

Bishoy Labib
Team Leader Link Development
Egypt Egypt
IF YOU WANT TO IMPROVE YOUR SOFTWARE, DON'T TEST MORE; DEVELOP BETTER.
 
http://bishoylabib.blogspot.com

Comments and Discussions

 
GeneralBUG: Hardcoded Path PinmemberSteffen Lange27-Sep-08 8:50 
GeneralHi Pinmemberyahtra1-Jul-07 22:48 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 25 Apr 2004
Article Copyright 2004 by Bishoy Labib
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid