ELEC2645 (2017/18) / Mbed OS el16ajm
Embed: (wiki syntax)

« Back to documentation index

Food Class Reference

Food Class Reference

The Food class. More...

#include <Food.h>

Public Member Functions

 Food ()
 Constructor.
 ~Food ()
 Destructor.
void init (int x, int y)
 Initialisation function.
int getX ()
 Gets the current X coordinate of the food.
int getY ()
 Gets the current Y coordinate of the food.
void random ()
 Randomises the current location of the food.

Detailed Description

The Food class.

Stores the position of the food to be eaten and randomises its location

Author:
Andrew J. Moore
Date:
May, 2018

Definition at line 12 of file Food.h.


Constructor & Destructor Documentation

Food (  )

Constructor.

Definition at line 4 of file Food.cpp.

~Food (  )

Destructor.

Definition at line 9 of file Food.cpp.


Member Function Documentation

int getX (  )

Gets the current X coordinate of the food.

Returns:
the current X coordinate

Definition at line 24 of file Food.cpp.

int getY (  )

Gets the current Y coordinate of the food.

Returns:
the current Y coordinate

Definition at line 29 of file Food.cpp.

void init ( int  x,
int  y 
)

Initialisation function.

Parameters:
theinital starting position for the food, given in X and Y (int)

Definition at line 16 of file Food.cpp.

void random (  )

Randomises the current location of the food.

Definition at line 34 of file Food.cpp.