Sixiang Miao / Mbed 2 deprecated Miao_Sixiang

Dependencies:   mbed N5110

Committer:
Rubio
Date:
Sun May 05 17:14:13 2019 +0000
Revision:
1:d80166c5602c
Parent:
0:7f86012fb8b5
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rubio 0:7f86012fb8b5 1 #include "mbed.h"
Rubio 0:7f86012fb8b5 2 #include "Gamepad.h"
Rubio 0:7f86012fb8b5 3 #include "N5110.h"
Rubio 0:7f86012fb8b5 4 #include "stdlib.h"
Rubio 0:7f86012fb8b5 5
Rubio 0:7f86012fb8b5 6 /** The integers to show whether the enemies could be used again */
Rubio 0:7f86012fb8b5 7 struct eninumber{
Rubio 1:d80166c5602c 8 int p1; /**< The first integer to show whether the ship is been hit*/
Rubio 1:d80166c5602c 9 int p2; /**< The second integer to show whether the ship is been hit*/
Rubio 0:7f86012fb8b5 10 };
Rubio 0:7f86012fb8b5 11
Rubio 0:7f86012fb8b5 12 /** enemies Class
Rubio 0:7f86012fb8b5 13 @brief Library for setting the numbers that shows whether there is a ship on the lcd and if not, generate one.
Rubio 0:7f86012fb8b5 14 @brief The library also could set random ship coordinates.
Rubio 0:7f86012fb8b5 15 @brief The library can generate two types of ships.
Rubio 0:7f86012fb8b5 16
Rubio 0:7f86012fb8b5 17
Rubio 0:7f86012fb8b5 18 @brief Revision 1.0
Rubio 0:7f86012fb8b5 19
Rubio 0:7f86012fb8b5 20 @author Miao Sixiang
Rubio 0:7f86012fb8b5 21 @date 18th April 2019
Rubio 0:7f86012fb8b5 22
Rubio 0:7f86012fb8b5 23 @code
Rubio 0:7f86012fb8b5 24 #include "mbed.h"
Rubio 0:7f86012fb8b5 25 #include "Gamepad.h"
Rubio 0:7f86012fb8b5 26 #include "N5110.h"
Rubio 0:7f86012fb8b5 27 #include "enemies.h"
Rubio 0:7f86012fb8b5 28 #include "math.h"
Rubio 0:7f86012fb8b5 29 #include "ship.h"
Rubio 0:7f86012fb8b5 30 #include "Bitmap.h"
Rubio 0:7f86012fb8b5 31
Rubio 0:7f86012fb8b5 32
Rubio 0:7f86012fb8b5 33 #ifdef WITH_TESTING
Rubio 0:7f86012fb8b5 34 #include "tests.h"
Rubio 0:7f86012fb8b5 35 #endif
Rubio 0:7f86012fb8b5 36
Rubio 0:7f86012fb8b5 37
Rubio 0:7f86012fb8b5 38 DigitalOut r_led(LED_RED);
Rubio 0:7f86012fb8b5 39 DigitalOut g_led(LED_GREEN);
Rubio 0:7f86012fb8b5 40 DigitalOut b_led(LED_BLUE);
Rubio 0:7f86012fb8b5 41 DigitalOut led1(PTA1);
Rubio 0:7f86012fb8b5 42 DigitalOut led2(PTA2);
Rubio 0:7f86012fb8b5 43 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Rubio 0:7f86012fb8b5 44
Rubio 0:7f86012fb8b5 45 Gamepad pad;
Rubio 0:7f86012fb8b5 46 enemies eni;
Rubio 0:7f86012fb8b5 47 ship shi;
Rubio 0:7f86012fb8b5 48
Rubio 0:7f86012fb8b5 49 void init();
Rubio 0:7f86012fb8b5 50 void welcome();
Rubio 0:7f86012fb8b5 51 bool explosionjudge(float x1,float y1,float x2,float y2);
Rubio 0:7f86012fb8b5 52 void explosion(int x, int y);
Rubio 0:7f86012fb8b5 53 void game_over();
Rubio 0:7f86012fb8b5 54
Rubio 0:7f86012fb8b5 55 float xp1,xp2,yp1,yp2,xn1,yn1,xn2,yn2,x,y,x1,y1,x2,y2,v;
Rubio 0:7f86012fb8b5 56 int p1,p2,score,high_score,count;
Rubio 0:7f86012fb8b5 57 Vector2D enic1 = {xn1, yn1};
Rubio 0:7f86012fb8b5 58 Vector2D enic2 = {xn2, yn2};
Rubio 0:7f86012fb8b5 59 const int explosion123[10][10] = {
Rubio 0:7f86012fb8b5 60 { 0,0,0,0,1,0,0,0,0,0 },
Rubio 0:7f86012fb8b5 61 { 0,1,0,1,0,1,0,0,1,0 },
Rubio 0:7f86012fb8b5 62 { 0,1,0,1,0,1,1,1,1,0 },
Rubio 0:7f86012fb8b5 63 { 0,0,1,0,0,0,0,1,0,0 },
Rubio 0:7f86012fb8b5 64 { 0,1,0,0,0,0,0,0,1,0 },
Rubio 0:7f86012fb8b5 65 { 0,1,0,0,0,0,0,0,1,0 },
Rubio 0:7f86012fb8b5 66 { 0,0,1,0,0,0,0,1,0,0 },
Rubio 0:7f86012fb8b5 67 { 0,1,0,1,0,0,1,1,0,0 },
Rubio 0:7f86012fb8b5 68 { 1,0,0,0,1,1,0,0,1,0 },
Rubio 0:7f86012fb8b5 69 { 0,0,0,0,0,0,0,0,0,0 },
Rubio 0:7f86012fb8b5 70 };
Rubio 0:7f86012fb8b5 71
Rubio 0:7f86012fb8b5 72 int main() {
Rubio 0:7f86012fb8b5 73
Rubio 0:7f86012fb8b5 74 //initial all the components
Rubio 0:7f86012fb8b5 75 init();//the lcd is initialed
Rubio 0:7f86012fb8b5 76 lcd.init();
Rubio 0:7f86012fb8b5 77 lcd.normalMode();
Rubio 0:7f86012fb8b5 78 lcd.setContrast(0.5);
Rubio 0:7f86012fb8b5 79
Rubio 0:7f86012fb8b5 80
Rubio 0:7f86012fb8b5 81 count = 0;
Rubio 0:7f86012fb8b5 82 score = 0;
Rubio 0:7f86012fb8b5 83 x = 5.0;
Rubio 0:7f86012fb8b5 84 y = 21.0;
Rubio 0:7f86012fb8b5 85 x1 = 0.0;
Rubio 0:7f86012fb8b5 86 y1 = 0.0;
Rubio 0:7f86012fb8b5 87 x2 = 0.0;
Rubio 0:7f86012fb8b5 88 y2 = 0.0;
Rubio 0:7f86012fb8b5 89 v = 4.0;
Rubio 0:7f86012fb8b5 90 p1 = p2 = 0;
Rubio 0:7f86012fb8b5 91 xp1 = xp2 = xn1 =xn2 =0.0;
Rubio 0:7f86012fb8b5 92 yp1 = yp2 = yn1 = yn2 =0.0;
Rubio 0:7f86012fb8b5 93 enic1.x = enic2.x = 0.0;
Rubio 0:7f86012fb8b5 94
Rubio 0:7f86012fb8b5 95 high_score = 0;
Rubio 0:7f86012fb8b5 96
Rubio 0:7f86012fb8b5 97 shi.set_ship(y,x,lcd);
Rubio 0:7f86012fb8b5 98
Rubio 0:7f86012fb8b5 99 welcome();
Rubio 0:7f86012fb8b5 100 while (1) {
Rubio 0:7f86012fb8b5 101 lcd.clear();
Rubio 0:7f86012fb8b5 102 Vector2D coord = pad.get_mapped_coord();
Rubio 0:7f86012fb8b5 103 x = x + coord.x;
Rubio 0:7f86012fb8b5 104 y = y - coord.y;
Rubio 0:7f86012fb8b5 105 shi.set_ship(y,x,lcd);
Rubio 0:7f86012fb8b5 106
Rubio 0:7f86012fb8b5 107 if (pad.check_event(Gamepad::A_PRESSED)){
Rubio 0:7f86012fb8b5 108 if (x1 == 0){
Rubio 0:7f86012fb8b5 109 x1 = x;
Rubio 0:7f86012fb8b5 110 y1 = y;
Rubio 0:7f86012fb8b5 111 x1 = shi.open_fire(x1,y1,v,lcd);
Rubio 0:7f86012fb8b5 112 if (!x2 ==0){
Rubio 0:7f86012fb8b5 113 x2 = shi.open_fire(x2,y2,v,lcd);
Rubio 0:7f86012fb8b5 114 }
Rubio 0:7f86012fb8b5 115 } else if (x1 > 0 and x2 == 0){
Rubio 0:7f86012fb8b5 116 x2 = x;
Rubio 0:7f86012fb8b5 117 y2 = y;
Rubio 0:7f86012fb8b5 118 x2 = shi.open_fire(x2,y2,v,lcd);
Rubio 0:7f86012fb8b5 119 x1 = shi.open_fire(x1,y1,v,lcd);
Rubio 0:7f86012fb8b5 120 } else if (x1 > 0 and x2 > 0){
Rubio 0:7f86012fb8b5 121 x2 = shi.open_fire(x2,y2,v,lcd);
Rubio 0:7f86012fb8b5 122 x1 = shi.open_fire(x1,y1,v,lcd);
Rubio 0:7f86012fb8b5 123 }
Rubio 0:7f86012fb8b5 124 } else if (x1 > 0 or x2 > 0) {
Rubio 0:7f86012fb8b5 125 if (x1 > 0){
Rubio 0:7f86012fb8b5 126 x1 = shi.open_fire(x1,y1,v,lcd);
Rubio 0:7f86012fb8b5 127 }
Rubio 0:7f86012fb8b5 128 if (x2 > 0){
Rubio 0:7f86012fb8b5 129 x2 = shi.open_fire(x2,y2,v,lcd);
Rubio 0:7f86012fb8b5 130 }
Rubio 0:7f86012fb8b5 131 }
Rubio 0:7f86012fb8b5 132 if (x1 >= 84){
Rubio 0:7f86012fb8b5 133 x1 = 0;
Rubio 0:7f86012fb8b5 134 }
Rubio 0:7f86012fb8b5 135 if (x2 >= 84) {
Rubio 0:7f86012fb8b5 136 x2 = 0;
Rubio 0:7f86012fb8b5 137 }
Rubio 0:7f86012fb8b5 138
Rubio 0:7f86012fb8b5 139
Rubio 0:7f86012fb8b5 140
Rubio 0:7f86012fb8b5 141 eninumber enin = eni.enemiesjudge(enic1.x, enic2.x);
Rubio 0:7f86012fb8b5 142 p1 = enin.p1;
Rubio 0:7f86012fb8b5 143 p2 = enin.p2;
Rubio 0:7f86012fb8b5 144 if (p1 == 1){
Rubio 0:7f86012fb8b5 145 enic1 = eni.set_coord1(p1);
Rubio 0:7f86012fb8b5 146 }
Rubio 0:7f86012fb8b5 147 if (p2 == 1){
Rubio 0:7f86012fb8b5 148 enic2 = eni.set_coord1(p2);
Rubio 0:7f86012fb8b5 149 }
Rubio 0:7f86012fb8b5 150 eni.drawenemies_small(enic1.x, enic1.y,lcd);
Rubio 0:7f86012fb8b5 151 eni.drawenemies_large(enic2.x, enic2.y,lcd);
Rubio 0:7f86012fb8b5 152
Rubio 0:7f86012fb8b5 153
Rubio 0:7f86012fb8b5 154 if (explosionjudge(enic1.x,enic1.y,x1,y1)) {
Rubio 0:7f86012fb8b5 155 explosion(x1, y1);
Rubio 0:7f86012fb8b5 156 x1 = 0;
Rubio 0:7f86012fb8b5 157 count = count + 1;
Rubio 0:7f86012fb8b5 158 enic1.x = 0;
Rubio 0:7f86012fb8b5 159 }
Rubio 0:7f86012fb8b5 160 if (explosionjudge(enic2.x,enic2.y,x1,y1)) {
Rubio 0:7f86012fb8b5 161 explosion(x1, y1);
Rubio 0:7f86012fb8b5 162 x1= 0;
Rubio 0:7f86012fb8b5 163 count = count + 1;
Rubio 0:7f86012fb8b5 164 enic2.x = 0;
Rubio 0:7f86012fb8b5 165 }
Rubio 0:7f86012fb8b5 166 if (explosionjudge(enic1.x,enic1.y,x2,y2)) {
Rubio 0:7f86012fb8b5 167 explosion(x1, y1);
Rubio 0:7f86012fb8b5 168 x2 = 0;
Rubio 0:7f86012fb8b5 169 count = count + 1;
Rubio 0:7f86012fb8b5 170 enic1.x = 0;
Rubio 0:7f86012fb8b5 171 }
Rubio 0:7f86012fb8b5 172 if (explosionjudge(enic2.x,enic2.y,x2,y2)) {
Rubio 0:7f86012fb8b5 173 explosion(x2, y2);
Rubio 0:7f86012fb8b5 174 count = count + 1;
Rubio 0:7f86012fb8b5 175 x2 = 0;
Rubio 0:7f86012fb8b5 176 enic2.x = 0;
Rubio 0:7f86012fb8b5 177 }
Rubio 0:7f86012fb8b5 178
Rubio 0:7f86012fb8b5 179
Rubio 0:7f86012fb8b5 180 score = count *50;
Rubio 0:7f86012fb8b5 181
Rubio 0:7f86012fb8b5 182
Rubio 0:7f86012fb8b5 183 if (xp1 <= 4) {
Rubio 0:7f86012fb8b5 184 xp1 = enic1.x;
Rubio 0:7f86012fb8b5 185 yp1 = enic1.y;
Rubio 0:7f86012fb8b5 186 }else if (xp1 > 0) {
Rubio 0:7f86012fb8b5 187 xp1 = eni.open_fire_en(xp1, yp1,lcd);
Rubio 0:7f86012fb8b5 188 }
Rubio 0:7f86012fb8b5 189 if (xp2 <= 4){
Rubio 0:7f86012fb8b5 190 xp2 = enic2.x;
Rubio 0:7f86012fb8b5 191 yp2 = enic2.y;
Rubio 0:7f86012fb8b5 192 }else if (xp2 > 0) {
Rubio 0:7f86012fb8b5 193 xp2 = eni.open_fire_en(xp2, yp2,lcd);
Rubio 0:7f86012fb8b5 194 }
Rubio 0:7f86012fb8b5 195
Rubio 0:7f86012fb8b5 196 if (score > high_score){
Rubio 0:7f86012fb8b5 197 high_score = score;
Rubio 0:7f86012fb8b5 198 }
Rubio 0:7f86012fb8b5 199
Rubio 0:7f86012fb8b5 200 if (explosionjudge(x,y,xp1,yp1)) {
Rubio 0:7f86012fb8b5 201 explosion(xp1, yp1);
Rubio 0:7f86012fb8b5 202 xp1 = 0;
Rubio 0:7f86012fb8b5 203 game_over();
Rubio 0:7f86012fb8b5 204 }
Rubio 0:7f86012fb8b5 205 if (explosionjudge(x,y,xp2,yp2)) {
Rubio 0:7f86012fb8b5 206 explosion(xp2, yp2);
Rubio 0:7f86012fb8b5 207 xp2 = 0;
Rubio 0:7f86012fb8b5 208 game_over();
Rubio 0:7f86012fb8b5 209 }
Rubio 0:7f86012fb8b5 210
Rubio 0:7f86012fb8b5 211
Rubio 0:7f86012fb8b5 212
Rubio 0:7f86012fb8b5 213
Rubio 0:7f86012fb8b5 214 wait(0.1);
Rubio 0:7f86012fb8b5 215 lcd.refresh();
Rubio 0:7f86012fb8b5 216 }
Rubio 0:7f86012fb8b5 217 }
Rubio 0:7f86012fb8b5 218
Rubio 0:7f86012fb8b5 219
Rubio 0:7f86012fb8b5 220
Rubio 0:7f86012fb8b5 221
Rubio 0:7f86012fb8b5 222
Rubio 0:7f86012fb8b5 223
Rubio 0:7f86012fb8b5 224 void init()
Rubio 0:7f86012fb8b5 225 {
Rubio 0:7f86012fb8b5 226 // need to initialise LCD and Gamepad
Rubio 0:7f86012fb8b5 227 pad.init();
Rubio 0:7f86012fb8b5 228
Rubio 0:7f86012fb8b5 229 count = 0;
Rubio 0:7f86012fb8b5 230 score = 0;
Rubio 0:7f86012fb8b5 231 x = 5.0;
Rubio 0:7f86012fb8b5 232 y = 21.0;
Rubio 0:7f86012fb8b5 233 x1 = 0.0;
Rubio 0:7f86012fb8b5 234 y1 = 0.0;
Rubio 0:7f86012fb8b5 235 x2 = 0.0;
Rubio 0:7f86012fb8b5 236 y2 = 0.0;
Rubio 0:7f86012fb8b5 237 v = 4.0;
Rubio 0:7f86012fb8b5 238 p1 = p2 = 0;
Rubio 0:7f86012fb8b5 239 xp1 = xp2 = xn1 =xn2 =0.0;
Rubio 0:7f86012fb8b5 240 yp1 = yp2 = yn1 = yn2 =0.0;
Rubio 0:7f86012fb8b5 241 enic1.x = enic2.x = 0.0;
Rubio 0:7f86012fb8b5 242
Rubio 0:7f86012fb8b5 243 // initialise the game with correct ball and paddle sizes
Rubio 0:7f86012fb8b5 244
Rubio 0:7f86012fb8b5 245 }
Rubio 0:7f86012fb8b5 246
Rubio 0:7f86012fb8b5 247
Rubio 0:7f86012fb8b5 248
Rubio 0:7f86012fb8b5 249 void welcome() {
Rubio 0:7f86012fb8b5 250
Rubio 0:7f86012fb8b5 251 lcd.printString(" HALO WAR ",0,1);
Rubio 0:7f86012fb8b5 252 lcd.printString(" Press Start ",0,4);
Rubio 0:7f86012fb8b5 253 lcd.refresh();
Rubio 0:7f86012fb8b5 254
Rubio 0:7f86012fb8b5 255 // wait flashing LEDs until start button is pressed
Rubio 0:7f86012fb8b5 256 while ( pad.check_event(Gamepad::START_PRESSED) == false) {
Rubio 0:7f86012fb8b5 257 pad.leds_on();
Rubio 0:7f86012fb8b5 258 wait(0.1);
Rubio 0:7f86012fb8b5 259 pad.leds_off();
Rubio 0:7f86012fb8b5 260 wait(0.1);
Rubio 0:7f86012fb8b5 261
Rubio 0:7f86012fb8b5 262 }
Rubio 0:7f86012fb8b5 263 }
Rubio 0:7f86012fb8b5 264
Rubio 0:7f86012fb8b5 265 bool explosionjudge(float x1,float y1,float x2,float y2){
Rubio 0:7f86012fb8b5 266 float d;
Rubio 0:7f86012fb8b5 267 d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
Rubio 0:7f86012fb8b5 268 if (d <= 9){
Rubio 0:7f86012fb8b5 269 return true;
Rubio 0:7f86012fb8b5 270 }else {
Rubio 0:7f86012fb8b5 271 return false;
Rubio 0:7f86012fb8b5 272 }
Rubio 0:7f86012fb8b5 273 }
Rubio 0:7f86012fb8b5 274
Rubio 0:7f86012fb8b5 275 void explosion(int x, int y){
Rubio 0:7f86012fb8b5 276
Rubio 0:7f86012fb8b5 277 lcd.drawSprite(x, y, 10, 10, (int *)explosion123);
Rubio 0:7f86012fb8b5 278 }
Rubio 0:7f86012fb8b5 279
Rubio 0:7f86012fb8b5 280
Rubio 0:7f86012fb8b5 281 void game_over(){
Rubio 0:7f86012fb8b5 282 while(!pad.check_event(Gamepad::START_PRESSED)){
Rubio 0:7f86012fb8b5 283 char buffer1[20];
Rubio 0:7f86012fb8b5 284 sprintf(buffer1, "High Score=%d", high_score);
Rubio 0:7f86012fb8b5 285 lcd.printString(buffer1,0,0);
Rubio 0:7f86012fb8b5 286 char buffer[14];
Rubio 0:7f86012fb8b5 287 sprintf(buffer, " Score = %d ", score);
Rubio 0:7f86012fb8b5 288 lcd.printString(buffer,0,1);
Rubio 0:7f86012fb8b5 289 lcd.printString(" Wasted ",0,2);
Rubio 0:7f86012fb8b5 290 lcd.printString("Press start to",0,3);
Rubio 0:7f86012fb8b5 291 lcd.printString(" new compaign",0,4);
Rubio 0:7f86012fb8b5 292 lcd.refresh();
Rubio 0:7f86012fb8b5 293 lcd.clear();
Rubio 0:7f86012fb8b5 294 }
Rubio 0:7f86012fb8b5 295 init();
Rubio 0:7f86012fb8b5 296 }
Rubio 0:7f86012fb8b5 297
Rubio 0:7f86012fb8b5 298 @endcode
Rubio 0:7f86012fb8b5 299 */
Rubio 0:7f86012fb8b5 300
Rubio 0:7f86012fb8b5 301 class enemies
Rubio 0:7f86012fb8b5 302 {
Rubio 0:7f86012fb8b5 303 public:
Rubio 0:7f86012fb8b5 304
Rubio 0:7f86012fb8b5 305 /** Judge whether there are any enemy ships in the lcd.
Rubio 0:7f86012fb8b5 306 *
Rubio 0:7f86012fb8b5 307 * @param xp1 The horizontal position of the first ship, if xp1 <= 0, means that the fisrt ship is not on the lcd.
Rubio 0:7f86012fb8b5 308 * @param xp2 The horizontal position of the second ship, if xp2 <= 0, means that the second ship is not on the lcd.
Rubio 0:7f86012fb8b5 309 * @returns
Rubio 0:7f86012fb8b5 310 * There are two elements in the struct, both 1 or 0;
Rubio 0:7f86012fb8b5 311 * 0 - There is already a ship on the lcd.
Rubio 0:7f86012fb8b5 312 * 1 - The ship could be draw on the lcd again.
Rubio 0:7f86012fb8b5 313 *
Rubio 0:7f86012fb8b5 314 */
Rubio 0:7f86012fb8b5 315 eninumber enemiesjudge(int xp1, int xp2);
Rubio 0:7f86012fb8b5 316
Rubio 0:7f86012fb8b5 317
Rubio 0:7f86012fb8b5 318
Rubio 0:7f86012fb8b5 319 /** To draw an enemy ship on the lcd, the smaller one, at the given position.
Rubio 0:7f86012fb8b5 320 *
Rubio 0:7f86012fb8b5 321 * @param x The horizontal position of the ship, set the core of the ship at x.
Rubio 0:7f86012fb8b5 322 * @param y The vertical position of the ship, set the core of the ship at y.
Rubio 0:7f86012fb8b5 323 *
Rubio 0:7f86012fb8b5 324 */
Rubio 0:7f86012fb8b5 325 void drawenemies_small(float x, float y, N5110 &lcd);
Rubio 0:7f86012fb8b5 326
Rubio 0:7f86012fb8b5 327
Rubio 0:7f86012fb8b5 328 /** To set new coordinates for the new ships.
Rubio 0:7f86012fb8b5 329 *
Rubio 0:7f86012fb8b5 330 * @param p1 The integer that could ensure whether the ship could be generated.
Rubio 0:7f86012fb8b5 331 * @returns
Rubio 0:7f86012fb8b5 332 * There are two elements in the vector.
Rubio 0:7f86012fb8b5 333 * x -The horizontal coordinate of the enemy ship
Rubio 0:7f86012fb8b5 334 * y -The vertical coordinate of the enemy ship
Rubio 0:7f86012fb8b5 335 */
Rubio 0:7f86012fb8b5 336 Vector2D set_coord1(int p1);
Rubio 0:7f86012fb8b5 337
Rubio 0:7f86012fb8b5 338
Rubio 0:7f86012fb8b5 339 /** To set new coordinates for the new ships.
Rubio 0:7f86012fb8b5 340 *
Rubio 0:7f86012fb8b5 341 * @param p2 The integer that could ensure whether the ship could be generated.
Rubio 0:7f86012fb8b5 342 * @returns
Rubio 0:7f86012fb8b5 343 * There are two elements in the vector.
Rubio 0:7f86012fb8b5 344 * x -The horizontal coordinate of the enemy ship
Rubio 0:7f86012fb8b5 345 * y -The vertical coordinate of the enemy ship
Rubio 0:7f86012fb8b5 346 */
Rubio 0:7f86012fb8b5 347 Vector2D set_coord2(int p2);
Rubio 0:7f86012fb8b5 348
Rubio 0:7f86012fb8b5 349
Rubio 0:7f86012fb8b5 350 /** To set a missile released by the enemies.
Rubio 0:7f86012fb8b5 351 *
Rubio 0:7f86012fb8b5 352 * @param x The horizontal coordinate of the enemy ship that will release missile.
Rubio 0:7f86012fb8b5 353 * @param y The vertical coordinate of the enemy ship that will release missile.
Rubio 0:7f86012fb8b5 354 * @returns
Rubio 0:7f86012fb8b5 355 * The last coordinate of the missile.
Rubio 0:7f86012fb8b5 356 * x -The horizontal coordinate of the missile
Rubio 0:7f86012fb8b5 357 *
Rubio 0:7f86012fb8b5 358 */
Rubio 0:7f86012fb8b5 359 int open_fire_en(int x, int y, N5110 &lcd);
Rubio 0:7f86012fb8b5 360
Rubio 0:7f86012fb8b5 361
Rubio 0:7f86012fb8b5 362 /** To draw an enemy ship on the lcd, the larger one, at the given position.
Rubio 0:7f86012fb8b5 363 *
Rubio 0:7f86012fb8b5 364 * @param x The horizontal position of the ship, set the core of the ship at x.
Rubio 0:7f86012fb8b5 365 * @param y The vertical position of the ship, set the core of the ship at y.
Rubio 0:7f86012fb8b5 366 *
Rubio 0:7f86012fb8b5 367 */
Rubio 0:7f86012fb8b5 368 void drawenemies_large(float x, float y, N5110 &lcd);
Rubio 0:7f86012fb8b5 369
Rubio 0:7f86012fb8b5 370 private:
Rubio 0:7f86012fb8b5 371 int _p1;
Rubio 0:7f86012fb8b5 372 int _p2;
Rubio 0:7f86012fb8b5 373 float _xp1;
Rubio 0:7f86012fb8b5 374 float _yp1;
Rubio 0:7f86012fb8b5 375 float _xp2;
Rubio 0:7f86012fb8b5 376 float _yp2;
Rubio 0:7f86012fb8b5 377 int _vp;
Rubio 0:7f86012fb8b5 378 };