ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el17sdl_v2

Dependencies:   mbed

Revision:
13:4fa0d5148216
Parent:
12:cb3a81adf48b
Child:
14:4356797fd16e
--- a/GameEngine/GameEngine.cpp	Sun May 24 14:19:21 2020 +0000
+++ b/GameEngine/GameEngine.cpp	Sun May 24 15:08:31 2020 +0000
@@ -13,8 +13,8 @@
 void GameEngine::init(int head_size, int head_speed) 
 {
     srand(time(NULL));
-     _mouse_x = rand() %(WIDTH-4);
-     _mouse_y = rand() %(HEIGHT-4);
+     _mouse_x = rand() %WIDTH+2;
+     _mouse_y = rand() %HEIGHT+2;
     _game_over = false;
     _score = 0;
     _mouse = 0;
@@ -73,8 +73,8 @@
         _mouse = 0;
         pad.tone(750.0, 0.1);
         srand(time(NULL));
-     _mouse_x = rand() %WIDTH-4;
-     _mouse_y = rand() %HEIGHT-4;
+     _mouse_x = rand() %WIDTH+2;
+     _mouse_y = rand() %HEIGHT+2;
      _length++;
     }
 }