ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_ll16j23s

Dependencies:   mbed ll16j23s_test_docs

Embed: (wiki syntax)

« Back to documentation index

Food Class Reference

Food Class Reference

SnakeEngine: More...

#include <Food.h>

Public Member Functions

void init (Gamepad &pad, N5110 &lcd, FXOS8700CQ &mag)
 Initialises magnetometer and seeds random function.
bool rand_pos (Gamepad &pad, N5110 &lcd)
 Chooses random coordinates for food.
void draw (N5110 &lcd)
 Animates food.
void run (N5110 &lcd)
 Runs food functions that need looping.

Detailed Description

SnakeEngine:

  • Functions that exclusively control the food
    Author:
    Joseph Shotton
    Date:
    May 2020
    Version:
    V1.0

Definition at line 16 of file Food.h.


Member Function Documentation

void draw ( N5110 &  lcd )

Animates food.

Parameters:
LCD

Definition at line 43 of file Food.cpp.

void init ( Gamepad &  pad,
N5110 &  lcd,
FXOS8700CQ &  mag 
)

Initialises magnetometer and seeds random function.

Parameters:
Gamepad
LCD
Magnetometer

Definition at line 16 of file Food.cpp.

bool rand_pos ( Gamepad &  pad,
N5110 &  lcd 
)

Chooses random coordinates for food.

Parameters:
Gamepad
LCD
Returns:
returns true if selected position is already on (ie the snake or walls are at this coordinate)

Definition at line 29 of file Food.cpp.

void run ( N5110 &  lcd )

Runs food functions that need looping.

Parameters:
LCD

Definition at line 56 of file Food.cpp.