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.

Committer:
maxint
Date:
Wed Jan 28 17:32:54 2015 +0000
Revision:
0:87ab172a74b4
Separated elements as objects, added gravity and bouncespeed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maxint 0:87ab172a74b4 1 #pragma once
maxint 0:87ab172a74b4 2 #include "mbed.h"
maxint 0:87ab172a74b4 3 #include "Vector.h"
maxint 0:87ab172a74b4 4
maxint 0:87ab172a74b4 5 class Point
maxint 0:87ab172a74b4 6 {
maxint 0:87ab172a74b4 7 protected :
maxint 0:87ab172a74b4 8 int x1, y1;
maxint 0:87ab172a74b4 9
maxint 0:87ab172a74b4 10 public :
maxint 0:87ab172a74b4 11 Point();
maxint 0:87ab172a74b4 12 Point(int x, int y);
maxint 0:87ab172a74b4 13 int getX();
maxint 0:87ab172a74b4 14 int getY();
maxint 0:87ab172a74b4 15 void set(int x, int y);
maxint 0:87ab172a74b4 16 };
maxint 0:87ab172a74b4 17
maxint 0:87ab172a74b4 18 class Rectangle
maxint 0:87ab172a74b4 19 {
maxint 0:87ab172a74b4 20 protected :
maxint 0:87ab172a74b4 21 int x1, x2, y1, y2;
maxint 0:87ab172a74b4 22
maxint 0:87ab172a74b4 23 public :
maxint 0:87ab172a74b4 24 Rectangle(int x,int y, int x2, int y2);
maxint 0:87ab172a74b4 25 Rectangle(Point pt1, Point pt2);
maxint 0:87ab172a74b4 26 bool collides(Point pt);
maxint 0:87ab172a74b4 27 bool collides(Rectangle r);
maxint 0:87ab172a74b4 28
maxint 0:87ab172a74b4 29 void set(Rectangle rNew);
maxint 0:87ab172a74b4 30
maxint 0:87ab172a74b4 31 Point get1();
maxint 0:87ab172a74b4 32 Point get2();
maxint 0:87ab172a74b4 33 Point get3();
maxint 0:87ab172a74b4 34 Point get4();
maxint 0:87ab172a74b4 35 Point getCenter();
maxint 0:87ab172a74b4 36
maxint 0:87ab172a74b4 37 int getX1();
maxint 0:87ab172a74b4 38 int getX2();
maxint 0:87ab172a74b4 39 int getY1();
maxint 0:87ab172a74b4 40 int getY2();
maxint 0:87ab172a74b4 41 int getCenterX();
maxint 0:87ab172a74b4 42 int getCenterY();
maxint 0:87ab172a74b4 43 void move(Vector v);
maxint 0:87ab172a74b4 44 };
maxint 0:87ab172a74b4 45
maxint 0:87ab172a74b4 46 class Circle
maxint 0:87ab172a74b4 47 {
maxint 0:87ab172a74b4 48 protected :
maxint 0:87ab172a74b4 49 int x1, y1, r1;
maxint 0:87ab172a74b4 50
maxint 0:87ab172a74b4 51 public :
maxint 0:87ab172a74b4 52 Circle(int x,int y, int r);
maxint 0:87ab172a74b4 53 Point getCenter();
maxint 0:87ab172a74b4 54 int getRadius();
maxint 0:87ab172a74b4 55 int getX();
maxint 0:87ab172a74b4 56 int getY();
maxint 0:87ab172a74b4 57 void setX(int x);
maxint 0:87ab172a74b4 58 void setY(int y);
maxint 0:87ab172a74b4 59 void setXY(int x, int y);
maxint 0:87ab172a74b4 60 void move(int x, int y);
maxint 0:87ab172a74b4 61 void move(Vector v);
maxint 0:87ab172a74b4 62 Rectangle getBoundingRectangle();
maxint 0:87ab172a74b4 63 };
maxint 0:87ab172a74b4 64