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
Grid Class Reference
#include <Grid.h>
Public Member Functions | |
Grid () | |
Grid object Constructor. | |
~Grid () | |
Grid object Destructor. | |
void | drawGrid (N5110 &lcd, int ghostnumber) |
Displays the grid maze where the game takes place. | |
void | init (ScreenArray &screen, int ghostnumber) |
Mutator method initialises the grid object by subsequently initialising the screen array object and the number of ghosts that can be generated in the game. | |
void | updateFruit (int x, int y, ScreenArray &screen) |
Mutator method used to remove a fruit from the grid when badman eats it. | |
bool | update (ScreenArray &screen, int ghostnumber, int x, int y, int r) |
Mutator method used for ghost-badman collision detection. | |
int | getFruitNumber () |
Accessor method gets the number of the charactersrpite objects(Fruits) currently on the screen. | |
void | generateFruits (ScreenArray &screen) |
FORMAT_CODE_START. | |
void | generateGhosts (ScreenArray &screen, int ghostnumber) |
Mutator method used for generating ghost characters within the grid of the game. |
Detailed Description
Grid Class.
- Date:
- April 2019 Grid Class
Controls and models the grid or maze used in the game main character for the badman game
- Version:
- 1.0
- Date:
- April 2019
Definition at line 33 of file Grid.h.
Constructor & Destructor Documentation
Member Function Documentation
void drawGrid | ( | N5110 & | lcd, |
int | ghostnumber | ||
) |
void generateFruits | ( | ScreenArray & | screen ) |
void generateGhosts | ( | ScreenArray & | screen, |
int | ghostnumber | ||
) |
Mutator method used for generating ghost characters within the grid of the game.
- Parameters:
-
screen Reference screen array object for the ghost-grid collision detection ghostnumber Integer value representing the number of ghosts currently observed at the current level
int getFruitNumber | ( | ) |
void init | ( | ScreenArray & | screen, |
int | ghostnumber | ||
) |
Mutator method initialises the grid object by subsequently initialising the screen array object and the number of ghosts that can be generated in the game.
- Parameters:
-
screen Reference screen array object used to initalise the screen array object used in the game ghostnumber Integer value representing the maximum number of ghost characters that can be generated in the badman game
bool update | ( | ScreenArray & | screen, |
int | ghostnumber, | ||
int | x, | ||
int | y, | ||
int | r | ||
) |
Mutator method used for ghost-badman collision detection.
- Parameters:
-
screen Reference screen array object for the ghost-grid collision detection ghostnumber Integer value representing the number of ghosts currently observed at the current level x Current x coordinate of the centre of the badman character object y Current y coordinate of the centre of the badman character object r Current radius(_size value) the badman character object
void updateFruit | ( | int | x, |
int | y, | ||
ScreenArray & | screen | ||
) |
Mutator method used to remove a fruit from the grid when badman eats it.
- Parameters:
-
x X coordinate of the point of impact between badman and the fruit y Y coordinate of the point of impact between badman and the fruit screen Reference screen array object for the removal of the fruit from the screen array object
Generated on Thu Aug 4 2022 12:05:20 by
