Flappy Bird game on mbed with a micro LCD screen, class D amp, speaker, SD card reader/writer, 5-button navigation switch, and potentiometer speed control
Dependencies: 4DGL-uLCD-SE PinDetect SDFileSystem mbed-rtos mbed
Diff: pipe.h
- Revision:
- 0:cd1d2540aaf4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pipe.h Tue Mar 15 01:11:07 2016 +0000 @@ -0,0 +1,32 @@ +#ifndef PIPE_H +#define PIPE_H + +// enumerated type that represents the 6 possible pipe sizes +enum pipeType {PIPE16, PIPE32, PIPE48, PIPE64, PIPE80, PIPE96}; + +// class that represents a pair of pipes in the Flappy Bird game +class Pipe +{ +public: + // Constructor + Pipe(); + // Get Functions + int getWidth(); // returns the pipe's width + int getX(); // returns the pipe's current x position + int getY(); // returns the pipe's current y position + int getOldX(); // returns the pipe's previous x position + pipeType getType(); // returns the pipe's size + // Member Functions + void move(int gameSpeed); // moves the pipe given the current game speed + +private: + // variables + int x; // the pipe's current x position + int y; // the height of the top pipe in the pair of pipes + int oldX; // the pipe's previous x position + pipeType type; // the pipe's size + // constants + static const int width = 32; // the pipe's width +}; + +#endif // PIPE_H \ No newline at end of file