ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18s2a_2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Snake Class Reference

Snake Class Reference

Snake Class File. More...

#include <Snake.h>

Public Member Functions

void init (int _x, int _y, int score, int _speed, int snakeheight, int snakewidth)
 The Initial setup of the of the snake
void draw (N5110 &lcd)
 For drawing the snake on the screen allows the use of the LCD
void update (Direction d, float mag)
void add_score ()
 Eating an apple will add to the score
int get_score ()
Vector2D get_pos ()
Vector2D get_move ()
Vector2D get_Direction ()
void set_move (Vector2D m)
 Sets the Movement of the snake

Detailed Description

Snake Class File.

Class containing the snake for the actual game.

Author:
Simon Atkinson
Date:
June 2020

Definition at line 14 of file Snake.h.


Member Function Documentation

void add_score (  )

Eating an apple will add to the score

Definition at line 88 of file Snake.cpp.

void draw ( N5110 lcd )

For drawing the snake on the screen allows the use of the LCD

Definition at line 26 of file Snake.cpp.

Vector2D get_Direction (  )
Returns:
Gets the direction the snake travels in can be only North, East, South or West and the snake can't move in other directions.
Vector2D get_move (  )
Returns:
Gets the value the determines how fast the snake moves

Definition at line 97 of file Snake.cpp.

Vector2D get_pos (  )
Returns:
Gets the position of the snake

Definition at line 104 of file Snake.cpp.

int get_score (  )
Returns:
Gives us the score

Definition at line 92 of file Snake.cpp.

void init ( int  _x,
int  _y,
int  score,
int  _speed,
int  snakeheight,
int  snakewidth 
)

The Initial setup of the of the snake

Definition at line 14 of file Snake.cpp.

void set_move ( Vector2D  m )

Sets the Movement of the snake

void update ( Direction  d,
float  mag 
)
Returns:
Gets the direction from the thumbstick

Definition at line 35 of file Snake.cpp.