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
bird.cpp
- Committer:
- Mpmart08
- Date:
- 2016-03-15
- Revision:
- 0:cd1d2540aaf4
File content as of revision 0:cd1d2540aaf4:
#include "bird.h" Bird::Bird(){ x = 16; // the bird starts 16 pixels from the left side of the screen y = 64; // the bird starts 64 pixels from the top of the screen } int Bird::getOldY() { return oldY; } int Bird::getX(){ return x; } int Bird::getY(){ return y; } int Bird::getWidth(){ return width; } int Bird::getHeight(){ return height; } void Bird::move(directionType direction){ oldY = y; // store old y position switch (direction){ case DIRECTION_UP: // the player pressed up y -= moveDistance; // the bird moves up by a constant distance break; case DIRECTION_DOWN: // the player pressed down y += moveDistance; // the bird moves down by a constant distance break; } }