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
pipe.h@0:cd1d2540aaf4, 2016-03-15 (annotated)
- Committer:
- Mpmart08
- Date:
- Tue Mar 15 01:11:07 2016 +0000
- Revision:
- 0:cd1d2540aaf4
added comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mpmart08 | 0:cd1d2540aaf4 | 1 | #ifndef PIPE_H |
Mpmart08 | 0:cd1d2540aaf4 | 2 | #define PIPE_H |
Mpmart08 | 0:cd1d2540aaf4 | 3 | |
Mpmart08 | 0:cd1d2540aaf4 | 4 | // enumerated type that represents the 6 possible pipe sizes |
Mpmart08 | 0:cd1d2540aaf4 | 5 | enum pipeType {PIPE16, PIPE32, PIPE48, PIPE64, PIPE80, PIPE96}; |
Mpmart08 | 0:cd1d2540aaf4 | 6 | |
Mpmart08 | 0:cd1d2540aaf4 | 7 | // class that represents a pair of pipes in the Flappy Bird game |
Mpmart08 | 0:cd1d2540aaf4 | 8 | class Pipe |
Mpmart08 | 0:cd1d2540aaf4 | 9 | { |
Mpmart08 | 0:cd1d2540aaf4 | 10 | public: |
Mpmart08 | 0:cd1d2540aaf4 | 11 | // Constructor |
Mpmart08 | 0:cd1d2540aaf4 | 12 | Pipe(); |
Mpmart08 | 0:cd1d2540aaf4 | 13 | // Get Functions |
Mpmart08 | 0:cd1d2540aaf4 | 14 | int getWidth(); // returns the pipe's width |
Mpmart08 | 0:cd1d2540aaf4 | 15 | int getX(); // returns the pipe's current x position |
Mpmart08 | 0:cd1d2540aaf4 | 16 | int getY(); // returns the pipe's current y position |
Mpmart08 | 0:cd1d2540aaf4 | 17 | int getOldX(); // returns the pipe's previous x position |
Mpmart08 | 0:cd1d2540aaf4 | 18 | pipeType getType(); // returns the pipe's size |
Mpmart08 | 0:cd1d2540aaf4 | 19 | // Member Functions |
Mpmart08 | 0:cd1d2540aaf4 | 20 | void move(int gameSpeed); // moves the pipe given the current game speed |
Mpmart08 | 0:cd1d2540aaf4 | 21 | |
Mpmart08 | 0:cd1d2540aaf4 | 22 | private: |
Mpmart08 | 0:cd1d2540aaf4 | 23 | // variables |
Mpmart08 | 0:cd1d2540aaf4 | 24 | int x; // the pipe's current x position |
Mpmart08 | 0:cd1d2540aaf4 | 25 | int y; // the height of the top pipe in the pair of pipes |
Mpmart08 | 0:cd1d2540aaf4 | 26 | int oldX; // the pipe's previous x position |
Mpmart08 | 0:cd1d2540aaf4 | 27 | pipeType type; // the pipe's size |
Mpmart08 | 0:cd1d2540aaf4 | 28 | // constants |
Mpmart08 | 0:cd1d2540aaf4 | 29 | static const int width = 32; // the pipe's width |
Mpmart08 | 0:cd1d2540aaf4 | 30 | }; |
Mpmart08 | 0:cd1d2540aaf4 | 31 | |
Mpmart08 | 0:cd1d2540aaf4 | 32 | #endif // PIPE_H |