SNAKE GAME
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
Diff: snake.h
- Revision:
- 0:24041b847eb5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/snake.h Wed Nov 25 04:25:25 2020 +0000 @@ -0,0 +1,31 @@ +// 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. + +#define SNAKE_MAX_LENGTH 50 + +// Structure of coordinates in the map +typedef struct{ + int x; + int y; +} Coordinate; + +// Snake Structure +typedef struct { + int head_x, head_y, head_px, head_py; // Location of the head of the snake + int length; // length of the snake + Coordinate locations[SNAKE_MAX_LENGTH]; // Snake body locations + int score; //Current score of the snake + int pointLockTime; + int speedupTime; + int slowdownTime; + bool invincible; + int invincTimer; +} Snake; + +// Initialize a snake structure +// You want to assign initial values to each of the variables defined above +// in the snake structure. +void snake_init (Snake * snake);