![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
1
Dependencies: mbed Gamepad N5110
Diff: Snake/Snake.h
- Revision:
- 9:5f73221012bf
- Parent:
- 7:cafa0b96e8d3
- Child:
- 10:7cb79dbb351a
diff -r cd73516e85b6 -r 5f73221012bf Snake/Snake.h --- a/Snake/Snake.h Sun May 05 12:11:52 2019 +0000 +++ b/Snake/Snake.h Sun May 05 12:33:23 2019 +0000 @@ -6,11 +6,11 @@ #include "Gamepad.h" #include "Food.h" - +/**snakePart struct */ struct snakePart{ - char _x[4000]; - char _y[4000]; - char _dirc[4000]; + char _x[4000];/**< Arrays to store snake X coordinate*/ + char _y[4000];/**< Arrays to store snake y coordinate*/ + char _dirc[4000];/**< Arrays to store snake direction*/ }; @@ -32,23 +32,28 @@ ~Snake(); /** initial snake's property - * @param the value of the initial cooridnate_x(int), coordinate_y(int), length(int), live(int) + * @param the value of the initial cooridnate_x(int) of snake tail + * @param the value of the initial coordinate_y(int) of snake tail + * @param the value of the initial length(int) of snake + * @param the value of the initial live(int) of snake */ void init(int x, int y, int length,int _live); - /** draw snake - * @param the subclass of N5110(lcd) and Gamepad(pad) + /** draw snake on the map + * @param the subclass of N5110(lcd) + * @param the subclass of Gamepad(pad) */ void drawsnake(N5110 &lcd, Gamepad &pad); - /** Determine the movement of snake + /** Determine the movement direction of snake * @param the subclass of Gamepad(pad) */ void snakemov(Gamepad &pad); /** Determine if the snake is dead - * @param the subclass of N5110(lcd) and Gamepad(pad) - * @return return 0 + * @param the subclass of N5110(lcd) + * @param the subclass of Gamepad(pad) + * @return return 0 to end loop */ int dead(N5110 &lcd, Gamepad &pad); @@ -58,12 +63,14 @@ void eat(Gamepad &pad); /** Determine if the snake collide the wall - * @param the subclass of N5110(lcd) and Gamepad(pad) + * @param the subclass of N5110(lcd) + * @param the subclass of Gamepad(pad) */ void check_WallCollision(N5110 &lcd, Gamepad &pad); /** Determine if the snake collide the tail - * @param the subclass of N5110(lcd) and Gamepad(pad) + * @param the subclass of N5110(lcd) + * @param the subclass of Gamepad(pad) */ void check_TailCollision(N5110 &lcd, Gamepad &pad); @@ -81,6 +88,7 @@ * @param the subclass of Gamepad(pad) */ void game_music(Gamepad &pad); + int _length; int live; float waitTime;