RSS

Search Engine

Thursday, September 30, 2010

Divide and Conquer

Years ago I was addicted to a simple game that I played on my then state-of-the-art Pentium-75. In this game, balls would bounce around, and I would try to partition them into small enough spaces so that I could go to the next level where more and more balls would be added. As of a couple of months ago, for the life of me, I couldn't remember the name of this game. So when I sat down to write an application for Android in my 20% time, I thought, why not try to recreate something similar? After completing most of the game and showing it to some of my friends at work, one of them said, "Oh, this reminds me of JezzBall!" Eureka! If working on this game does nothing more than reveal the name of one of the favorite games of my youth, I'll call it a success, but in the meantime, I'm happy to announce that the source of this application, named Divide and Conquer, is now available on apps-for-android.

The game starts with instructions:

and begins simply enough with one ball bouncing around. You drag your finger in a horizontal or vertical gesture on the screen to initiate a line that extends until it reaches the edges:

In each level, once you've shaved off 80% of the original area, you move to the next level. Here's a screen shot of level 6:

If a ball hits a line in progress, you lose a life:

Once you are out of lives, it is game over:

While this game isn't going to win any awards for cutting edge graphics, it demonstrates use of several Android features and APIs:

  • custom drawing and animation
  • touch input based gesture detection
  • overriding the default behavior of the back key in some situations (to pause the game)
  • creating custom Dialogs
  • configuring an application to be full screen with no title or status bar
  • use of the preferences framework
  • use of the vibrator API

DivideAndConquerView is a custom View that implements its own onDraw method using the Canvas methods, and gesture detection using onTouchEvent and a helper class DirectionPoint. It keeps track of the state of the game using BallEngine, and reports relevant events back to the main activity of the application, which, in turn, keeps track of and controls the state of the game. The application is configured to be full screen in its AndroidManifest.xml file.

3 comments:

Power of love said...

I will spare no efforts in doing things WOW Power Leveling, the master of a single trade can support a family. The master of seven trades cannot support himself wow gold, No one has ever been or will ever be strong enough to take our freedom away from us Sell WOW Gold.

The bravery of each bull is then rated with care according to the number of times he demonstrates his willingness to charge in spite of the sting of the blade Runescape gp, Henceforth will I recognize that each day I am tested by life in like manner. If I persist, if I continue to try, if I continue to charge forward, I will succeed rs gp, Your future depends on your dreams Runescape2 Gold. So go to sleep. Do not keep anything for a special occasion..

xiayumin said...

Today's cloud is so beautiful,because it rained yesterday.If you like playing Elder Scrolls Online this game,i reconmand MMOAH.com to you.because you can buy Cheap ESO Gold.

smrtsmith said...

I am also a game enthusiast. I bought a very cheap POE Currency on the mmoah website, and the delivery speed is very good. I am very satisfied with the purchase.

Post a Comment