Ikenna Adrian Ozoemena 201157039

Dependencies:   mbed

Revision:
38:4571537238ed
Parent:
37:8d8c8cce0bc7
Child:
39:7824f9080f59
--- a/Enemy/Enemy.cpp	Sat May 04 05:37:33 2019 +0000
+++ b/Enemy/Enemy.cpp	Sun May 05 08:50:15 2019 +0000
@@ -37,33 +37,26 @@
     _seeker_ypos = 0;
     _shno = shno;
     // initialize shooter
-    _vx1 = 1;
+    _vx1 = 2;
     _vx2 = 2;
     _vx3 = 3;
     _vy1 = 1;
     _vy2 = 2;
     _vy3 = 1;
     // for now just starting them spaced apart add randomizer later
-    if(_shno == 1) {
-        _shooter_xpos1 = rand_no(68);
-        _shooter_ypos1 = 1;
-    }
-    if(_shno == 2) {
-        _shooter_xpos1 = rand_no(68);
-        _shooter_ypos1 = 1;
-        _shooter_xpos2 = rand_no(68);
-        _shooter_ypos2 = 1;
-    }
-    if(_shno == 3) {
+
         _shooter_xpos1 = rand_no(68);
         _shooter_ypos1 = 1;
         _shooter_xpos2 = rand_no(68);
         _shooter_ypos2 = 1;
         _shooter_xpos3 = rand_no(68);
         _shooter_ypos3 = 1;
-    }
 
 }
+void Enemy::set_noshooters(int no_shooters)
+{
+    _shno = no_shooters;
+}
 // Draw the ship ***Note: figure out how to change ship type e.g from basic to devotion
 void Enemy::draw_seeker(N5110 &lcd)
 {
@@ -346,4 +339,28 @@
     int rand_no = (rand() %scale) + 1;
     // printf("random no = %d\n",rand_no);
     return rand_no;
+}
+void Enemy::sh_scaling(int time_elapsed)
+{
+    // add if functions for shno
+    // correct movement
+    int vmax = 2;
+    if(_vx1 > -vmax && _vx1 < vmax){
+        _vx2 = _vx2 * 1.1;
+    }
+    if(_vx2 > - vmax && _vx2 < vmax){
+        _vx2 = _vx2 * 1.1;
+    }
+    if(_vx3 > -vmax && _vx3 < vmax){
+        _vx3 = _vx3 * 1.1;
+    }
+    if(_vy1 > -vmax && _vy1 < vmax){
+        _vy1 = _vy1 * 1.1;
+    }
+    if(_vy2 > -vmax && _vy2 < vmax){
+        _vy2 = _vy2 * 1.1;
+    }
+    if(_vy3 > -vmax && _vy3 < vmax){
+        _vy3 = _vy3 * 1.1;
+    }      
 }
\ No newline at end of file