Mbed Galaga Game
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player
Diff: Enemy.h
- Revision:
- 0:c4b6bb8c2bf4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Enemy.h Mon Mar 14 16:34:47 2016 +0000 @@ -0,0 +1,74 @@ +#include "uLCD_4DGL.h" +uLCD_4DGL uLCD(p28,p27,p29); // serial tx, serial rx, reset pin; + +class Enemy +{ + +public: + void draw() { + + uLCD.filled_rectangle(xPosition,yPosition,xPosition2,yPosition2,color); + } + + + void erase() + { + uLCD.filled_rectangle(xPosition,yPosition,xPosition2,yPosition2,0x000000); + + } + void moveDown(int distance) { + yPosition=yPosition+distance; + yPosition2=yPosition2+distance; + } + + void moveRight(int distance) { + yPosition=xPosition+distance; + yPosition2=xPosition2+distance; + } + + void moveLeft(int distance) { + yPosition=xPosition-distance; + yPosition2=xPosition2-distance; + } + + +int getXPosition() +{ + return xPosition; +} +int getXPosition2() +{ + return xPosition2; +} + +int getYPosition() +{ + return yPosition; +} + +int getYPosition2() +{ + return yPosition2; +} + + +Enemy(int xloc1, int yloc1, int xloc2, int yloc2, int col) + { + xPosition=xloc1; + yPosition=yloc1; + xPosition2=xloc2; + yPosition2=yloc2; + color=col; + + } + +private: + int xPosition; + int yPosition; + int xPosition2; + int yPosition2; + int color; + int isHit; +}; + +