ELEC2645 (2017/18) / Mbed OS el16ajm
Revision:
7:c1e0593bfc99
Parent:
5:a3a9e0417e04
Child:
12:d3eef5ea3f43
--- a/Snek/Snek.cpp	Mon Apr 30 15:07:08 2018 +0000
+++ b/Snek/Snek.cpp	Mon Apr 30 18:14:24 2018 +0000
@@ -15,7 +15,7 @@
 {
     //Inital values for variables
     _length = 3;
-    
+
     _oldDirection = 'N';
 
     for (int i = 0; i < _length; i++) {
@@ -27,10 +27,10 @@
 void Snek::update(Direction d)
 {
     for (int i = _length-1; i >= 1; i--) {
-            _x[i] =  _x[i-1];
-            _y[i] =  _y[i-1];
+        _x[i] =  _x[i-1];
+        _y[i] =  _y[i-1];
     }
-    
+
     if (d == N && _oldDirection != 'S') { //checks the current direction so the snake cannot go back on itself
         _y[0] -= 1;
         _oldDirection = 'N';
@@ -53,7 +53,7 @@
         }  else if (_oldDirection == 'W') {
             _x[0] -= 1;
         }
-    }    
+    }
 }
 
 int Snek::getX(int ref)
@@ -75,3 +75,4 @@
 {
     _length+=1;
 }
+