P2-2 Harris Barton
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
Diff: snake.cpp
- Revision:
- 3:e2fb359d6545
- Parent:
- 2:4947d6a82971
--- a/snake.cpp Fri Oct 23 16:30:18 2020 -0400 +++ b/snake.cpp Wed Nov 25 01:17:39 2020 +0000 @@ -8,5 +8,21 @@ void snake_init (Snake * s) { - -} + s->head_x = 5; + s->head_px =0; + s->head_y = 5; + s->head_py =0; + s->length = 3; + + for (int i = 0; i < SNAKE_MAX_LENGTH; i++) { + s->locations[i].x = s->head_x - i; + s->locations[i].y = s->head_y; + } + + s->pointLockTime = 0; //Time that snake can't gain points + s->speedupTime = 0; + s->slowdownTime = 0; + s->score = 0; //Current score of the snake + s->invincible = false; + s->invincTimer = 0; +} \ No newline at end of file