Peng Jingran / Mbed 2 deprecated Snake_copy

Dependencies:   mbed FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Snake Class Reference

Snake Class Reference

Snake Class. More...

#include <Snake.h>

Public Member Functions

 Snake ()
 Constructor.
 ~Snake ()
 Destructor.
void draw (N5110 &lcd)
 Set the draw.
void update (Gamepad &pad)
 Set the gamepad.
void deadSnake (N5110 &lcd)
 Set the deadsnake.
void init (int x, int y, int lenght, int _live)
 Set the inital snake.
void addPoint ()
 Set the point.
void checkWallCollision (N5110 &lcd)
 Check the wall collision.
void checkTailCollision (N5110 &lcd)
 Check the tail collision.
void drawScore (N5110 &lcd)
 Show the score.

Data Fields

int _length
 Show the length.

Detailed Description

Snake Class.

Does nothing useful

Author:
Du Xianjie
Date:
May, 2019

Definition at line 28 of file Snake.h.


Constructor & Destructor Documentation

Snake (  )

Constructor.

Definition at line 13 of file Snake.cpp.

~Snake (  )

Destructor.

Definition at line 17 of file Snake.cpp.


Member Function Documentation

void addPoint (  )

Set the point.

Parameters:
foodpoint()
void checkTailCollision ( N5110 lcd )

Check the tail collision.

Parameters:
collision(N5110&lcd)

Definition at line 226 of file Snake.cpp.

void checkWallCollision ( N5110 lcd )

Check the wall collision.

Parameters:
collision(N5110&lcd)

Definition at line 211 of file Snake.cpp.

void deadSnake ( N5110 lcd )

Set the deadsnake.

Parameters:
deadsnake(N5110 &lcd)

Definition at line 194 of file Snake.cpp.

void draw ( N5110 lcd )

Set the draw.

Parameters:
thefigure (N5110 &lcd)

Definition at line 49 of file Snake.cpp.

void drawScore ( N5110 lcd )

Show the score.

Parameters:
score(N5110&lcd)

Definition at line 240 of file Snake.cpp.

void init ( int  x,
int  y,
int  lenght,
int  _live 
)

Set the inital snake.

Parameters:
initialsnake(int x, int y, int lenght,int _live)

Definition at line 23 of file Snake.cpp.

void update ( Gamepad pad )

Set the gamepad.

Parameters:
screen(Gamepad &pad)

Definition at line 82 of file Snake.cpp.


Field Documentation

int _length

Show the length.

Returns:
length(_length)

Definition at line 73 of file Snake.h.