ELEC2645 (2018/19) / Mbed 2 deprecated el17aio

Dependencies:   mbed

Revision:
21:628fb703188f
Parent:
20:5b4b3bf5795c
Child:
22:8cad70085883
diff -r 5b4b3bf5795c -r 628fb703188f RosenEngine/RosenEngine.cpp
--- a/RosenEngine/RosenEngine.cpp	Sun Apr 14 06:25:16 2019 +0000
+++ b/RosenEngine/RosenEngine.cpp	Sun Apr 14 10:11:43 2019 +0000
@@ -18,9 +18,9 @@
     // initialise the game parameters
     _ship.init(ship_width,ship_height,ship_speed,ship_xpos,ship_ypos);
     // place seeker above the ship
-    _enemy.init(44, 0);
+    _enemy.init(48,0);
     _menu.init(16);
-    _health.init(_xcursor);
+    _health.init(_shipno);
 
 }
 
@@ -38,12 +38,12 @@
     _health.draw_health(lcd);
     _health.draw_shields(lcd);
     _enemy.draw_seeker(lcd);
-    if(_xcursor == 0) {
+    if(_shipno == 0) {
         _ship.set_dimensions(9,6);
         _ship.draw_ship(lcd);
         _weapons.draw(lcd);
     }
-    if(_xcursor == 1) {
+    if(_shipno == 1) {
         _ship.set_dimensions(7,10);
         _ship.draw_imperion(lcd);
 
@@ -68,11 +68,11 @@
 void RosenEngine::update(Gamepad &pad)
 {
     _enemy.update_seeker(ship_xpos, ship_ypos);
-    if(_xcursor == 0) {
+    if(_shipno == 0) {
         _ship.update_ship(_xjoystick,_yjoystick);
         _weapons.update();
     }
-    if(_xcursor == 1 && A_button == false) {
+    if(_shipno == 1 && A_button == false) {
         _ship.update_ship(_xjoystick,_yjoystick);
         _weapons.update();
     }
@@ -100,10 +100,10 @@
     _ycursor = _menu.get_ycursor();
     return _ycursor;
 }
-int RosenEngine::get_xcursor()
+int RosenEngine::get_shipno()
 {
-    _xcursor = _menu.get_xcursor();
-    return _xcursor;
+    _shipno = _menu.get_xcursor();
+    return _shipno;
 }
 void RosenEngine::ship_select(N5110 &lcd)
 {
@@ -125,14 +125,14 @@
     for(int countx = 0; countx<=9; countx=countx+1) {
         ship_x[countx] = ship_pos.x + countx;
         seeker_x[countx] = seeker_pos.x + countx;
-         //printf("ship_x = %d, seeker_x = %d\n", ship_x[countx], seeker_x[countx]);
+        // printf("ship_x = %d, seeker_x = %d\n", ship_x[countx], seeker_x[countx]);
     }
 
     // create an array of all y positions for the ship sprite i.e along its height (ship_y)
     for(int county = 0; county<=6; county=county+1) {
         ship_y[county] = ship_pos.y + county;
         seeker_y[county] = seeker_pos.y + county;
-         //printf("ship_y = %d, seeker_y = %d\n", ship_y[county], seeker_y[county]);
+        //printf("ship_y = %d, seeker_y = %d\n", ship_y[county], seeker_y[county]);
     }
     // check all values of ship position against all values of seekers x position
     for(int nx = 0; nx<=9; nx=nx+1) {
@@ -150,8 +150,7 @@
         }
     }
 
-
-     printf("xcol = %d, ycol = %d\n", xcol, ycol);
+    printf("xcol = %d, ycol = %d\n", xcol, ycol);
     if(xcol == true && ycol == true) {
         _health.update(1);
         _enemy.reset_seeker();