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
Ghost Class Reference
#include <Ghost.h>
Public Member Functions | |
Ghost () | |
Default Ghost object constructor. | |
~Ghost () | |
Default Ghost object destructor. | |
void | init (int size, int x, int y) |
Mutator method initialises the ghost character object setting it's radius and start position in the maze. | |
void | draw (N5110 &lcd) |
Mutator method displays the ghost character on the lcd screen dependent on it's current x and y coordinates and size. | |
bool | collisiondetection (int x, int y, int r) |
Accessor method checks whether the ghost object has collided with the badman character object. | |
Vector2D | getPos () |
Accessor method gets the current coordinates of the ghost character object. | |
void | update (ScreenArray &screen) |
Mutator method updates the ghost object's movement in the instance that the ghost has collided with a wall. | |
int | checkCollision (ScreenArray &screen) |
Accessor method checks ghost-wall collisions. | |
void | setPos (int x, int y) |
Mutator method gets the current x and y coordinate of the ghost object to the coordinate passed in the function call. | |
int | getSize () |
Accessor method gets the size of badman character object. |
Detailed Description
Ghost Class.
- Date:
- April 2019 Ghost Class
Controls and models the ghost character for the badman game
- Version:
- 1.0
- Date:
- April 2019
Definition at line 30 of file Ghost.h.
Constructor & Destructor Documentation
Member Function Documentation
int checkCollision | ( | ScreenArray & | screen ) |
bool collisiondetection | ( | int | x, |
int | y, | ||
int | r | ||
) |
Accessor method checks whether the ghost object has collided with the badman character object.
- Parameters:
-
x Integer value giving the x coordinate of the badman character object y Integer value giving the y coordinate of the badman character object r Integer value giving the radius of the badman character object
- Returns:
- Returns a boolean value notifying whether a ghost-badman collision has occured
void draw | ( | N5110 & | lcd ) |
Vector2D getPos | ( | ) |
int getSize | ( | ) |
Accessor method gets the size of badman character object.
- Returns:
- Returns the size(radius ) of the badman character object
void init | ( | int | size, |
int | x, | ||
int | y | ||
) |
Mutator method initialises the ghost character object setting it's radius and start position in the maze.
- Parameters:
-
size Integer value giving the radius of the ghost object x Integer value giving the x coordinate of the ghost object y Integer value giving the y coordinate of the ghost object
void setPos | ( | int | x, |
int | y | ||
) |
Mutator method gets the current x and y coordinate of the ghost object to the coordinate passed in the function call.
- Parameters:
-
x X coordinate value of the new position the ghost character object is to move to y Y coordinate value of the new position the ghost character object is to move to
void update | ( | ScreenArray & | screen ) |
Generated on Thu Aug 4 2022 12:05:20 by
