Samuel Lashmar 201170334

Dependencies:   mbed

Revision:
10:3958fb08696d
Parent:
9:f0213e632379
Child:
12:cb3a81adf48b
--- a/SnakeHead/SnakeHead.cpp	Fri May 22 11:08:40 2020 +0000
+++ b/SnakeHead/SnakeHead.cpp	Fri May 22 12:29:53 2020 +0000
@@ -18,7 +18,7 @@
     _y = HEIGHT/2 - _size/2;
     
     srand(time(NULL));
-    int direction = rand() %4;
+    int direction = rand() %3;
     
     if (direction == 0) { //snake moves north
         _velocity.x = -_speed;
@@ -28,11 +28,11 @@
         _velocity.x = 0;
         _velocity.y = _speed;
         }
-    else if (direction == 2) { //sake moves south
+    else if (direction == 2) { //snake moves south
         _velocity.x = _speed;
         _velocity.y = 0;
         }
-    else { //snake moves west
+    else if (direction == 3){ //snake moves west
         _velocity.x = 0;
         _velocity.y = -_speed;
         }
@@ -56,8 +56,8 @@
     } else if (_y > 48) {
         _y = 48 - _size;
     }
-    printf("head x = %i\n", _x);
-    printf("head y = %i\n", _y);
+    //printf("head x = %i\n", _x);
+    //printf("head y = %i\n", _y);
 }
 
 void SnakeHead::change_direction(Direction d) {