Owen Cavender 201159294

Dependencies:   mbed Gamepad2

Revision:
3:d17d712c2e45
Parent:
2:44e4a6ecdbef
--- a/snake.cpp	Tue May 26 18:35:44 2020 +0000
+++ b/snake.cpp	Tue May 26 18:37:01 2020 +0000
@@ -15,7 +15,7 @@
 {
 
     //WIDTH =84 HEIGHT = 42 //snakebody[0] is initalised may have to initilaise the other 2 og snake parts
-    _length = 2;                                                // ROB how do i initalise
+    _length = 2;                                                //  how do i initalise
     _gameover = false;
     _score = 0;
     _direction = up;
@@ -56,7 +56,7 @@
     Vector2D Snakehead = _engine.get_Snakehead();
     Vector2D oldSnakehead = _engine.get_oldSnakehead();
 
-    Vector2D *_snakebody = new Vector2D [_length];            // ROB im unsure that this code would work- creates dynamic array - each bit having 2 parts (x,y) - number of bits of snakebody = length
+    Vector2D *_snakebody = new Vector2D [_length];            //  im unsure that this code would work- creates dynamic array - each bit having 2 parts (x,y) - number of bits of snakebody = length
 
     _snakebody[0].x = Snakehead.x;                            // snakebody[0] = Snakehead
     _snakebody[0].y = Snakehead.y;
@@ -89,7 +89,7 @@
         for(int i=2; i<=_length; i++) {                     //0 being head of snake  so snakepos[1]=snakepos[0] which is the head - moving up one place
             _snakebody[i].x = _snakebody[i-1].x;              //Snake needs to follow itself - low numbers lead the way
             _snakebody[i].y = _snakebody[i-1].y;
-            if(_snakebody[i].x == Snakehead.x && _snakebody[i].y == Snakehead.y) {  // ROB Unsure how to initially define the snake with (3 bits, when score =0) starting position  *without* redeclaring Vector2D *snakebody = new Vector2D [_length];
+            if(_snakebody[i].x == Snakehead.x && _snakebody[i].y == Snakehead.y) {  //  Unsure how to initially define the snake with (3 bits, when score =0) starting position  *without* redeclaring Vector2D *snakebody = new Vector2D [_length];
                 _gameover = true;
 
             }
@@ -98,7 +98,7 @@
         for(int i = 0; i <= _length; i++) {
             lcd.setPixel(_snakebody[i].x, _snakebody[i].y, 1);
 
-            //ROB is snakebody[0] being plotted? do you think this would work?
+            // is snakebody[0] being plotted? do you think this would work?
             // ideally would define snakebody[0], snakebody[1], snake[2] so the snake starts as 3 bits and bit 1 knows to go to bit zero, bit 2 know to go to bit 1 position
 
         }
@@ -136,7 +136,7 @@
 
     if(Snakehead.x == Applepos.x && Snakehead.y == Applepos.y) {
 
-        lcd.setPixel(Applepos.x, Applepos.y, 0);   // Problem:: Wanted to make sure that this didnt clear the pixel of the snake as it passes through it
+        lcd.setPixel(Applepos.x, Applepos.y, 0);   // Plem:: Wanted to make sure that this didnt clear the pixel of the snake as it passes through it
         _score++;                                 //by waiting unil the snake has passed through before clearing the old apple however the new apple spawn needs to be ASAP after collection
         _length = _length++;
         _engine.set_Applepos(lcd);    //randomises new values for _apx,_apy and draws on lcd -- the position is not needed until we compare it to Snakehead