Retro game that let's the player steer a ball through a hole filled maze. Has multiple levels of increasing difficulty.

Dependencies:   LCD_ST7735 MusicEngine RETRO_BallsAndThings mbed

Ball and Holes

In this game I attempted to create somewhat natural movement of the ball by implementing gravity and friction which combined over time determine the speed of the ball. Playing with the settings (aka. the magic numbers) that are spread out all over game.cpp, gives different effects, such as an icy, rough or liquid-like surface.

It took some time to figure out how to post my very first youtube video. Sorry for the shaky recording. Trying to record the video with my phone while playing the game in one hand was quite challenging, but here it is;

The left and right buttons are used to cheat: restart the current or go to the next level. Up and down control the game-tick. During game-play the robot-button shows the accelerator graph and the ship-button mutes the sound.

BTW. If your ball happens to get stuck, tilting the console in the opposite direction will set it free. For sake of argument: these magnetic wall-ends are in the words of Bob Ross "a happy accident". Since there is no specific code for it, others might call it a bug. As it results in more interesting game-play, I didn't attempt to fix it, but left a comment for those who dare to look at the mess I call code.

Files at this revision

API Documentation at this revision

Comitter:
maxint
Date:
Sun Mar 01 13:16:19 2015 +0000
Parent:
9:7bd5def2115d
Child:
11:ef3cbc443f27
Commit message:
ready for submisison?

Changed in this revision

Game.cpp Show annotated file Show diff for this revision Revisions of this file
RETRO_BallsAndThings.lib Show annotated file Show diff for this revision Revisions of this file
--- a/Game.cpp	Sun Mar 01 10:23:48 2015 +0000
+++ b/Game.cpp	Sun Mar 01 13:16:19 2015 +0000
@@ -4,7 +4,7 @@
 const char* Game::LOSE_2 = "Press ship to restart.";
 const char* Game::SPLASH_1 = "-*- Ball and holes -*-";
 const char* Game::SPLASH_2 = "Press ship to start.";
-const char* Game::SPLASH_3 = "Made by Maxint";
+const char* Game::SPLASH_3 = "Tilt console to steer ball.";
 
 
 #define WHITE Color565::White
@@ -413,7 +413,7 @@
 
         if(!this->left.read())
         {   // cheat: restart level
-            snd.playTune();
+            snd.play("T240 L128 O6 CEF");
             ball.fActive=false;
             initLevel();
             wait_ms(500);
@@ -422,7 +422,7 @@
         }
         else if(!this->right.read())
         {   // cheat: next level
-            snd.playTune();
+            snd.play("T240 L128 O5 FEC");
             nScore++;
             ball.fActive=false;
             initLevel();
@@ -533,19 +533,6 @@
                     ball.Bounce(Vector(-0.1,1));
                 }
                 //ball.vSpeed.multiply(Vector(0,0));
-
-                // TODO: workaround for stuck-in-wall bug
-                if(ball.collides(rWall))
-                {
-                    snd.beepLow();
-                    ball.fActive=false;
-                    initLevel();
-                    wait_ms(500);
-                    newBall();     // start a new ball
-                }
-
-
-                
                 
                 aWalls[i].draw();
             }
--- a/RETRO_BallsAndThings.lib	Sun Mar 01 10:23:48 2015 +0000
+++ b/RETRO_BallsAndThings.lib	Sun Mar 01 13:16:19 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/maxint/code/RETRO_BallsAndThings/#860b82c19ecf
+http://developer.mbed.org/users/maxint/code/RETRO_BallsAndThings/#5fd14e840fa8