ELEC2645 (2018/19) / Mbed 2 deprecated el17m2h_public

Dependencies:   mbed

Revision:
30:863565e9859f
Parent:
29:15e9640646b7
Child:
31:5c4acae51026
diff -r 15e9640646b7 -r 863565e9859f Floors/Floors.cpp
--- a/Floors/Floors.cpp	Wed May 08 21:11:35 2019 +0000
+++ b/Floors/Floors.cpp	Thu May 09 08:59:39 2019 +0000
@@ -24,6 +24,7 @@
 void Floors::draw(N5110 &lcd)
 {
     lcd.drawRect(_position.x, _position.y, _width, _height, FILL_BLACK);
+    eny.draw(lcd); // draws enemy
 }
 
 void Floors::update(float doodler_pos_x, float doodler_pos_y, float _bullet_pos_x, float _bullet_pos_y)
@@ -32,11 +33,11 @@
 //rectangle (1-82 & 9 - 48 )
     _doodler_pos_x = doodler_pos_x;
     _doodler_pos_y = doodler_pos_y;
-    if (_position.y > 45 ) {
+    if (_position.y > 45 ) { // the place decision bool is updated every time a floor re-appears
         _position.y = 9;
         _position.x = 1 + (rand()% 70);
-        place = rand()% 8;
-        if (place == 2) { // 1/8 chance of placing a ghost
+        place = rand()% 6;
+        if (place == 2) { // 1/6 chance of placing a ghost
             eny.update(_position);
             put_enemy = true;
         } else{
@@ -44,7 +45,9 @@
             put_enemy = false;
         }
     }
-    if (_doodler_pos_y < 15) { // shift floors once doodler reaches over halfway the screen
+    if (_doodler_pos_y < 13) { // shift floors once doodler reaches this value on the screen
+    // I chose this value because testing with the doodler's jump, it allows the doodler to keep jumping on a floor
+    // without it moving down and dissapearing
         _position.y  += 1;
     }
     check_enemy(_bullet_pos_x, _bullet_pos_y);