Balls & Paddle game for RETRO Pong inspired game featuring multi-directional tilt-sensitive paddle, multiple balls, shrinking ceiling and a bit of gravity.

Dependencies:   LCD_ST7735 MusicEngine RETRO_BallsAndThings mbed

Balls and Paddle

After doing some work on the Pong mod I decided to put my efforts into making my version object oriented and try to make a generic object-library that could be use for other ball-and-things games. To add some challenges to the gameplay, the following features were added:

  • extra-free additional balls to please the juglers
  • gravity for pulling the ball down to create some dynamic movement
  • directional power-paddle that counters the ball with a bit more speed
  • lowering ceiling to make endless gameplay impossible

Files at this revision

API Documentation at this revision

Comitter:
maxint
Date:
Sun Mar 01 13:58:47 2015 +0000
Parent:
4:8643d2d93a5f
Child:
6:1f5862465b5d
Commit message:
ready for submission?

Changed in this revision

Game.cpp Show annotated file Show diff for this revision Revisions of this file
Game.h 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	Thu Feb 26 11:55:13 2015 +0000
+++ b/Game.cpp	Sun Mar 01 13:58:47 2015 +0000
@@ -4,7 +4,7 @@
 const char* Game::LOSE_2 = "Press ship to restart";
 const char* Game::SPLASH_1 = "-*- Balls and paddle -*-";
 const char* Game::SPLASH_2 = "Press ship to start";
-const char* Game::SPLASH_3 = "Made by Maxint.";
+const char* Game::SPLASH_3 = "Left/Right/tilt to play.";
 
 #define WHITE Color565::White
 #define BLACK Color565::Black
@@ -22,7 +22,11 @@
 //
 
 Game::Game() : left(P0_14, PullUp), right(P0_11, PullUp), down(P0_12, PullUp), up(P0_13, PullUp), square(P0_16, PullUp), circle(P0_1, PullUp), led1(P0_9), led2(P0_8), 
-    ain(P0_15), i2c(P0_5, P0_4), disp(P0_19, P0_20, P0_7, P0_21, P0_22, P1_15, P0_2, LCD_ST7735::RGB), accel(this->I2C_ADDR, &disp), vGravity(0, 0.1), ball(&disp), paddle(&disp)
+    ain(P0_15), 
+    //i2c(P0_5, P0_4), 
+    disp(P0_19, P0_20, P0_7, P0_21, P0_22, P1_15, P0_2, LCD_ST7735::RGB), accel(this->I2C_ADDR, &disp), vGravity(0, 0.1), 
+    //ball(&disp), 
+    paddle(&disp)
 {
     this->disp.setOrientation(LCD_ST7735::Rotate270, false);
     this->disp.setForegroundColor(WHITE);
--- a/Game.h	Thu Feb 26 11:55:13 2015 +0000
+++ b/Game.h	Sun Mar 01 13:58:47 2015 +0000
@@ -40,7 +40,7 @@
     DigitalOut led1;
     DigitalOut led2;
     AnalogIn ain;
-    I2C i2c;
+    //I2C i2c;
     LCD_ST7735 disp;
 
     SoundFX snd;
@@ -48,7 +48,7 @@
 //    Timer tWait;    // timer used for tickcounts
 
     Vector vGravity;
-    Ball ball;
+    //Ball ball;
     Paddle paddle;
     Ball aBalls[NUM_BALLS];
 
--- a/RETRO_BallsAndThings.lib	Thu Feb 26 11:55:13 2015 +0000
+++ b/RETRO_BallsAndThings.lib	Sun Mar 01 13:58:47 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/maxint/code/RETRO_BallsAndThings/#441dc90d10ce
+http://developer.mbed.org/users/maxint/code/RETRO_BallsAndThings/#860b82c19ecf