Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: body/body.h
- Revision:
- 2:430dcf420840
diff -r 0648f0052827 -r 430dcf420840 body/body.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/body/body.h Fri Jun 05 22:51:49 2020 +0000 @@ -0,0 +1,91 @@ +#ifndef BODY_H +#define BODY_H + +#include "mbed.h" +#include "Gamepad.h" +#include "N5110.h" +#include "food.h" + +class Body +{ + +public: + + /** Constructor */ + Body(); + + /** Destructor */ + ~Body(); + + /** Initialises body of snake */ + void init(); + + /** checks if user has lost the game */ + void game_end(N5110 &lcd); + + /** removes the historical location of pixels to depict movement */ + void trail_delete(N5110 &lcd); + + /** takes input from userfor movement */ + void user_input(Gamepad &pad); + + /** alters direction of snake based on input */ + void movement(); + + /** sets a visual verson of the snake on the pad */ + void visual(N5110 &lcd, Gamepad &pad, Food &food); + + /** checks if previous food has been consumed */ + void food_eaten(N5110 &lcd, Gamepad &pad, Food &food); + + + /** defines button input on gamepad */ + enum Input { + Button_top, + Button_bottom, + Button_right, + Button_left, + }; + + int score_display(); + int score; + + bool endgame_check(); + bool endgame; + + int sx0; + int sx1; + int sx2; + int sx3; + int sx4; + int sx5; + int sx6; + int sx7; + int sx8; + int sx9; + int sy0; + int sy1; + int sy2; + int sy3; + int sy4; + int sy5; + int sy6; + int sy7; + int sy8; + int sy9; + + Input input_check; + +private: + + +}; + +#endif + + + + + + + \ No newline at end of file