SNAKE GAME
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
snake.cpp
- Committer:
- congvu
- Date:
- 2020-11-25
- Revision:
- 0:24041b847eb5
File content as of revision 0:24041b847eb5:
// Copyright 2020 Georgia Tech. All rights reserved. // The materials provided by the instructor in this course are for // the use of the students currently enrolled in the course. // Copyrighted course materials may not be further disseminated. // This file must not be made publicly available anywhere. #include "snake.h" 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; }