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.
element Class Reference
snakegame More...
#include <element.h>
Public Member Functions | |
element () | |
Constructor. | |
~element () | |
Destructor. | |
void | init (int foodsize, int foodx, int foody, int snakex, int snakey, int n) |
initialize the snake and the food | |
Vector2D | getfoodpos () |
get the position of food | |
Vector2D | getsnakepos (int n) |
get the position of the n th segment of snake | |
void | draw (N5110 &lcd, int n) |
draw the graph | |
void | update () |
upadate the coordinates of food as a random value in a specific range | |
void | input (Gamepad &pad) |
input the control | |
void | move (int n) |
move the snake |
Detailed Description
snakegame
snakegame
- Date:
- May.2019
Definition at line 12 of file element.h.
Constructor & Destructor Documentation
element | ( | ) |
Constructor.
Definition at line 2 of file element.cpp.
~element | ( | ) |
Destructor.
Definition at line 7 of file element.cpp.
Member Function Documentation
void draw | ( | N5110 & | lcd, |
int | n | ||
) |
draw the graph
- Parameters:
-
the N5110 lcd the value of length of snake
Definition at line 36 of file element.cpp.
Vector2D getfoodpos | ( | ) |
Vector2D getsnakepos | ( | int | n ) |
get the position of the n th segment of snake
- Returns:
- position of the n th segment of snake
Definition at line 113 of file element.cpp.
void init | ( | int | foodsize, |
int | foodx, | ||
int | foody, | ||
int | snakex, | ||
int | snakey, | ||
int | n | ||
) |
initialize the snake and the food
- Parameters:
-
the value of the foodsize the value of the x of coordinates of the food the value of the y of coordinates of the food the value of the x of coordinates of the snake the value of the y of coordinates of the snake the value of the snakelength
Definition at line 11 of file element.cpp.
void input | ( | Gamepad & | pad ) |
void move | ( | int | n ) |
void update | ( | ) |
upadate the coordinates of food as a random value in a specific range
Definition at line 22 of file element.cpp.
Generated on Wed Jul 13 2022 11:12:21 by
