ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19zf

Dependencies:   mbed

Revision:
19:5083339b55e8
Parent:
16:cf2bfada3adf
--- a/shot/shot.cpp	Thu May 21 15:20:33 2020 +0000
+++ b/shot/shot.cpp	Thu May 21 17:07:46 2020 +0000
@@ -33,7 +33,7 @@
 
     _size = 7;
     _size_f = 7.0;
-    _p.resize(_size);
+    _p.resize(_size);//initalises 7 shots vector
     srand(time(NULL));
     for (std::vector<shot_posandtype>::iterator i = _p.begin(); i < _p.end(); i++) {
         init_pos(i);
@@ -133,9 +133,9 @@
             (((*i).x==3)&&((*i).y==18))   ||   (((*i).x==4)&&((*i).y==28))||
             (((*i).x==79)&&((*i).y==16))  ||   (((*i).x==79)&&((*i).y==29)))  
         {
-            init_pos(i);//generate new shots to keep the total number
+            init_pos(i);//generate new shots instead of those shots which beyoud border 
             (*i).type = ((*i).type + 2)%4;
-            (*i).dir = ((*i).dir + 1)%6; // increase randomness
+            (*i).dir = ((*i).dir + 1)%6; // reset their type and dir (complex calculate to increase randomness)
         }
     }
 }