XJEL2645 (18/19) / Mbed 2 deprecated 2645_Mygame

Dependencies:   mbed Gamepad N5110

Revision:
9:18b059e5abb9
Parent:
7:d61290faf602
Child:
10:68076e3dcc33
--- a/snake/snake.cpp	Tue Apr 16 09:24:49 2019 +0000
+++ b/snake/snake.cpp	Sat Apr 20 08:15:10 2019 +0000
@@ -76,7 +76,7 @@
     ball_x = 3 + rand() % (WIDTH - 6); // randomise initial position of ball. 
     ball_y = 3 + rand() % (HEIGHT - 6);
     for (int i = 0; i < length; i++) {
-        if(ball_x + _size > _x[i] && ball_x - _size < _x[i] && ball_y + _size > _y[i] && ball_y - _size < _y[i]){
+        if(ball_x + _size >= _x[i] && ball_x - _size <= _x[i] && ball_y + _size >= _y[i] && ball_y - _size <= _y[i]){
                 srand(time(NULL));
                 ball_x = 3 + rand() % (WIDTH - 6); // randomise initial position of ball. 
                 ball_y = 3 + rand() % (HEIGHT - 6);