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
Move Class Reference
#include <Move.h>
Public Member Functions | |
| Move () | |
| Constructor. | |
| ~Move () | |
| Destructor. | |
| void | initial () |
| initial all the parameter for the snake and food. | |
| void | onlcd (N5110 &lcd) |
| Print snake, walls and food on LCD. | |
| void | update (Gamepad &pad) |
| Update new direction and snake head. | |
| void | updatebody () |
| Update whole snakebody. | |
| void | getfood () |
| Use random number to generate a new food on screen while old food has benn eaten. | |
| void | die (N5110 &lcd, Gamepad &pad) |
| check if snake head collide the wall or its body. | |
| void | eatfood () |
| check if snake head hit the food. | |
Detailed Description
Move Class.
Class for main engine for the snake game
- Date:
- 8th May 2019
Definition at line 31 of file Move.h.
Constructor & Destructor Documentation
Member Function Documentation
check if snake head collide the wall or its body.
- Parameters:
-
N5110 *lcd
pointer to the N5110 object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function.
- Parameters:
-
Gamepad *pad
pointer to the gamepad object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function.
| void getfood | ( | ) |
| void initial | ( | ) |
| void onlcd | ( | N5110 & | lcd ) |
| void update | ( | Gamepad & | pad ) |
Generated on Tue Jul 12 2022 22:27:32 by
1.7.2