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: bird.h
- Revision:
- 0:cd1d2540aaf4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bird.h Tue Mar 15 01:11:07 2016 +0000 @@ -0,0 +1,33 @@ +#ifndef BIRD_H +#define BIRD_H + +// enumerated type that represents the direction that the bird moves +enum directionType {DIRECTION_UP, DIRECTION_DOWN}; + +// class that represents the bird in the Flappy Bird game +class Bird +{ +public: + // Constructor + Bird(); + // Get Functions + int getX(); // return the bird's current x position + int getY(); // return the bird's current y position + int getOldY(); // return the bird's previous y position + int getWidth(); // return the bird's width + int getHeight(); // return the bird's height + // Member Functions + void move(directionType); // moves the bird in a given direction + +private: + // variables + int x; // the bird's x position + int y; // the bird's y position + int oldY; // the bird's previous y position + // constants + static const int width = 16; // the bird's width + static const int height = 16; // the bird's height + static const int moveDistance = 8; // the distance that the bird moves +}; + +#endif // BIRD_H \ No newline at end of file