ELEC2645 (2018/19) / Mbed 2 deprecated ml17z4c_attempt2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Eng Class Reference

Eng Class Reference

The Game class. More...

#include <Eng.h>

Public Member Functions

 Eng ()
 Constructor.
 ~Eng ()
 Destructor.
void init ()
 The init function.
void userinput (Gamepad &pad)
 load map function
void draw (N5110 &lcd)
 draw the game picture @param use LCD to draw
void score (N5110 &lcd)
 draw the game over picture @param give score and wait 5 seconds to play again
void update (Gamepad &pad)
 Updates game state.
float getScore ()
 Gets score.
bool getGameOver ()
 Gets gameover.
bool checkFood ()
 Gets checkFood.
void growSnake ()
 extand the snake function
void dead ()
 check weather the snake dead

Data Fields

bool _gameOver
 Gets _gameOver.
int _score
 some variables used to save score direction, map, food and others

Detailed Description

The Game class.

Handles all failure states and game drawing

Author:
ZIYI CHEN
Date:
May 2019

Definition at line 13 of file Eng.h.


Constructor & Destructor Documentation

Eng (  )

Constructor.

Definition at line 3 of file Eng.cpp.

~Eng (  )

Destructor.

Definition at line 8 of file Eng.cpp.


Member Function Documentation

bool checkFood (  )

Gets checkFood.

Returns:
value of checkFood

Definition at line 114 of file Eng.cpp.

void dead (  )

check weather the snake dead

Returns:
snake dead game end

Definition at line 89 of file Eng.cpp.

void draw ( N5110 lcd )

draw the game picture @param use LCD to draw

Definition at line 28 of file Eng.cpp.

bool getGameOver (  )

Gets gameover.

Returns:
ifgameOver

Definition at line 138 of file Eng.cpp.

float getScore (  )

Gets score.

Returns:
score

Definition at line 132 of file Eng.cpp.

void growSnake (  )

extand the snake function

Returns:
snake grow

Definition at line 123 of file Eng.cpp.

void init (  )

The init function.

Definition at line 13 of file Eng.cpp.

void score ( N5110 lcd )

draw the game over picture @param give score and wait 5 seconds to play again

Definition at line 41 of file Eng.cpp.

void update ( Gamepad pad )

Updates game state.

Parameters:
checkand update the game state

Definition at line 59 of file Eng.cpp.

void userinput ( Gamepad pad )

load map function

Parameters:
drowmap on lcd

Definition at line 23 of file Eng.cpp.


Field Documentation

bool _gameOver

Gets _gameOver.

Returns:
value of _gameOver

Definition at line 81 of file Eng.h.

int _score

some variables used to save score direction, map, food and others

Definition at line 84 of file Eng.h.