![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
tao lao
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
Diff: snake.cpp
- Revision:
- 3:33bf11645fe1
- Parent:
- 2:4947d6a82971
--- a/snake.cpp Fri Oct 23 16:30:18 2020 -0400 +++ b/snake.cpp Tue Nov 24 05:05:10 2020 +0000 @@ -8,5 +8,14 @@ void snake_init (Snake * s) { - + s->head_x = 0; + s->head_px =0; + s->head_y = 0; + s->head_py =0; + s->length = 3; + + for (int i = 0; i < SNAKE_MAX_LENGTH; i++) + {s->locations[i].x = s->head_px; + s->locations[i].y = s->head_py;} + s->score = 0; //Current score of the snake }