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.
Dependencies: mbed
Snake Class Reference
Snake Class Owen Cavender, University of Leeds. More...
#include <snake.h>
Public Types | |
| enum | Directions { up } |
deconstructor More... | |
Public Member Functions | |
| ~Snake () | |
| constructor | |
| void | get_direction (Gamepad &pad) |
| initialises 'Snake' class | |
| void | render_clear_tail (N5110 &lcd) |
| reads input from gamepad updates direction | |
| void | move_snake () |
| clears pixel on the end of snake before everything else on the screen is updated and rendered | |
| void | apple_collected (N5110 &lcd, Gamepad &pad) |
| alters the values assigned to the snake's body based on the _direction set in get_direction | |
| void | check_gameover (N5110 &lcd) |
| check to see if the apple x,y = snakehead x,y values increases score, triggers a true which causes generation of apple, updates counter Plays a tone and toggles LEDs | |
| void | get_Apple_position (N5110 &lcd) |
| checks if game is over based on 3 conditions | |
| void | render (N5110 &lcd, Gamepad &pad) |
| sets the apple position an update of position is triggered by bool _reset_apple | |
| Vector2D | get_Snakehead () |
| draws the snake, border, and apple during the game if it is game over, it displays the score and a gameo over message | |
| int | get_countdown () |
| returns _x0, and _y0 values | |
| int | get_score () |
| reurns counter value | |
Detailed Description
Snake Class Owen Cavender, University of Leeds.
Definition at line 13 of file snake.h.
Member Enumeration Documentation
| enum Directions |
Constructor & Destructor Documentation
Member Function Documentation
| void check_gameover | ( | N5110 & | lcd ) |
| void get_Apple_position | ( | N5110 & | lcd ) |
| void get_direction | ( | Gamepad & | pad ) |
| Vector2D get_Snakehead | ( | ) |
| void move_snake | ( | ) |
Generated on Wed Jul 20 2022 02:14:09 by
1.7.2