ELEC2645 (2019/20)
/
ELEC2645_Project_el17oc1
Owen Cavender 201159294
Diff: snake.cpp
- Revision:
- 7:0ce806455ef1
- Parent:
- 6:bf90044188d0
- Child:
- 8:997f90c88246
diff -r bf90044188d0 -r 0ce806455ef1 snake.cpp --- a/snake.cpp Thu May 28 15:02:30 2020 +0000 +++ b/snake.cpp Thu May 28 15:08:11 2020 +0000 @@ -31,7 +31,7 @@ _gameover = false; _score = 0; _direction = up; - // Vector2D *_snakebody = new Vector2D [_length]; + // Vector2D *_snakebody = new Vector2D [_length]; } @@ -46,9 +46,7 @@ lcd.setPixel(Apos.x, Apos.y, 0); // Plem:: Wanted to make sure that this didnt clear the pixel of the snake as it passes through it _score++; timer.reset(); - //by waiting unil the snake has passed through before clearing the old apple however the new apple spawn needs to be ASAP after collection - //randomises new values for _apx,_apy and draws on lcd -- draws on next loop-- the position is not needed until we compare it to Snakehead - pad.tone(1500.0,0.5); //need to clear apple + pad.tone(1500.0,0.5); pad.leds_on(); wait(0.5); pad.leds_off(); @@ -264,7 +262,7 @@ void Snake::print_display_time(N5110 &lcd) { - int countdown = _realtime; + int countdown = _realtime; char buffer1[14]; sprintf(buffer1,"%2d",countdown);