Mbed Galaga Game
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player
Enemy.h
00001 #include "uLCD_4DGL.h" 00002 uLCD_4DGL uLCD(p28,p27,p29); // serial tx, serial rx, reset pin; 00003 00004 class Enemy 00005 { 00006 00007 public: 00008 void draw() { 00009 00010 uLCD.filled_rectangle(xPosition,yPosition,xPosition2,yPosition2,color); 00011 } 00012 00013 00014 void erase() 00015 { 00016 uLCD.filled_rectangle(xPosition,yPosition,xPosition2,yPosition2,0x000000); 00017 00018 } 00019 void moveDown(int distance) { 00020 yPosition=yPosition+distance; 00021 yPosition2=yPosition2+distance; 00022 } 00023 00024 void moveRight(int distance) { 00025 yPosition=xPosition+distance; 00026 yPosition2=xPosition2+distance; 00027 } 00028 00029 void moveLeft(int distance) { 00030 yPosition=xPosition-distance; 00031 yPosition2=xPosition2-distance; 00032 } 00033 00034 00035 int getXPosition() 00036 { 00037 return xPosition; 00038 } 00039 int getXPosition2() 00040 { 00041 return xPosition2; 00042 } 00043 00044 int getYPosition() 00045 { 00046 return yPosition; 00047 } 00048 00049 int getYPosition2() 00050 { 00051 return yPosition2; 00052 } 00053 00054 00055 Enemy(int xloc1, int yloc1, int xloc2, int yloc2, int col) 00056 { 00057 xPosition=xloc1; 00058 yPosition=yloc1; 00059 xPosition2=xloc2; 00060 yPosition2=yloc2; 00061 color=col; 00062 00063 } 00064 00065 private: 00066 int xPosition; 00067 int yPosition; 00068 int xPosition2; 00069 int yPosition2; 00070 int color; 00071 int isHit; 00072 }; 00073 00074
Generated on Sun Aug 28 2022 20:13:31 by 1.7.2