ELEC2645 (2018/19) / Mbed 2 deprecated el17ntkv

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Grid Class Reference

Grid Class Reference

Grid Class. More...

#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.

Author:
Mr Nigel TK Vere, University of Leeds Controls and models the grid or maze used in the game main character for the badman game
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
Author:
Mr Nigel TK Vere
Date:
April 2019

Definition at line 33 of file Grid.h.


Constructor & Destructor Documentation

Grid (  )

Grid object Constructor.

Definition at line 4 of file Grid.cpp.

~Grid (  )

Grid object Destructor.

Definition at line 8 of file Grid.cpp.


Member Function Documentation

void drawGrid ( N5110 lcd,
int  ghostnumber 
)

Displays the grid maze where the game takes place.

Parameters:
lcdReference Nokia 5110 LCD screen object
ghostnumberInteger value representing the maximum number of ghost characters that can be generated in the badman game

Definition at line 161 of file Grid.cpp.

void generateFruits ( ScreenArray screen )

FORMAT_CODE_START.

Mutator method used for generating fruits in the game FORMAT_CODE_END

Parameters:
screenReference screen array object for the ghost-grid collision detection

Definition at line 60 of file Grid.cpp.

void generateGhosts ( ScreenArray screen,
int  ghostnumber 
)

Mutator method used for generating ghost characters within the grid of the game.

Parameters:
screenReference screen array object for the ghost-grid collision detection
ghostnumberInteger value representing the number of ghosts currently observed at the current level

Definition at line 109 of file Grid.cpp.

int getFruitNumber (  )

Accessor method gets the number of the charactersrpite objects(Fruits) currently on the screen.

Returns:
Returns the number of charactersprite objects on the screen

Definition at line 217 of file Grid.cpp.

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:
screenReference screen array object used to initalise the screen array object used in the game
ghostnumberInteger value representing the maximum number of ghost characters that can be generated in the badman game

Definition at line 11 of file Grid.cpp.

bool update ( ScreenArray screen,
int  ghostnumber,
int  x,
int  y,
int  r 
)

Mutator method used for ghost-badman collision detection.

Parameters:
screenReference screen array object for the ghost-grid collision detection
ghostnumberInteger value representing the number of ghosts currently observed at the current level
xCurrent x coordinate of the centre of the badman character object
yCurrent y coordinate of the centre of the badman character object
rCurrent radius(_size value) the badman character object

Definition at line 203 of file Grid.cpp.

void updateFruit ( int  x,
int  y,
ScreenArray screen 
)

Mutator method used to remove a fruit from the grid when badman eats it.

Parameters:
xX coordinate of the point of impact between badman and the fruit
yY coordinate of the point of impact between badman and the fruit
screenReference screen array object for the removal of the fruit from the screen array object

Definition at line 143 of file Grid.cpp.