ELEC2645 (2018/19) / Mbed 2 deprecated el17dg

Dependencies:   mbed

Fork of el17dg by Dmitrijs Griskovs

Revision:
28:35af3843de8f
Parent:
27:f05f4e738ba9
Child:
29:579e00b7f118
--- a/game/stars.h	Mon Apr 08 14:41:57 2019 +0000
+++ b/game/stars.h	Wed Apr 10 15:42:10 2019 +0000
@@ -5,6 +5,8 @@
 const int max_medium_stars = 5;
 const int small_star_speed = 2;
 const int medium_star_speed = 6;
+const int stars_delay_max = 5;
+int stars_delay;
 
 class Stars {
 public:
@@ -81,5 +83,16 @@
             }
         }
     }
+    
+    /** A separate function for delaying the stars spawn time.*/
+    void starsSpawnDelay(){
+        if  (stars_delay == stars_delay_max){ 
+        //This is dealy between stars generation.
+        newSmallStarFlies();
+        newMediumStarFlies();
+        stars_delay = 0;
+        }
+        else {stars_delay += 1;}   
+    }
 };
 #endif
\ No newline at end of file