ELEC2645 (2017/18) / Mbed 2 deprecated ll13jrm

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Food Class Reference

Food Class Reference

Food Class. More...

#include <Food.h>

Public Member Functions

void init (bool collision)
 Initialise position of food.
void update (bool collision, int n_frames)
 Updates food state.
void draw (N5110 &lcd)
 Draws food on lcd.
Vector2D get_rand_pos ()
 Gets a random position for spawning food.
void set_food_position (int set_frames, int number_frames, bool collision)
 resets food position when collsion event or a set number of frames have passed
Vector2D get_food_position ()

Detailed Description

Food Class.

Describes the methods and functions for the food class

Author:
Joshua R. Marshall
Date:
Feb, 2018

Definition at line 20 of file Food.h.


Member Function Documentation

void draw ( N5110 lcd )

Draws food on lcd.

Definition at line 50 of file Food.cpp.

Vector2D get_food_position (  )
Returns:
returns food position

Definition at line 118 of file Food.cpp.

Vector2D get_rand_pos (  )

Gets a random position for spawning food.

Definition at line 58 of file Food.cpp.

void init ( bool  collision )

Initialise position of food.

Definition at line 29 of file Food.cpp.

void set_food_position ( int  set_frames,
int  number_frames,
bool  collision 
)

resets food position when collsion event or a set number of frames have passed

Parameters:
set_framescorresponds to frame counter
number_framesnumber of frames before resetting food position
whentrue reset food position

Definition at line 74 of file Food.cpp.

void update ( bool  collision,
int  n_frames 
)

Updates food state.

Definition at line 38 of file Food.cpp.