ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_ll16j23s

Dependencies:   mbed ll16j23s_test_docs

Embed: (wiki syntax)

« Back to documentation index

SnakeBody Class Reference

SnakeBody Class Reference

SnakeBody: More...

#include <SnakeBody.h>

Public Member Functions

void init ()
 Initialises the body.
void add_length (int increase)
 Adjusts the _length_increase variable so the snake's length gradually increases.
void run (Gamepad &pad, N5110 &lcd, bool &_death)
 Runs the appropriate functions for the body.
void reset ()
 Resets body variables so game can be replayed.

Detailed Description

SnakeBody:

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

Definition at line 17 of file SnakeBody.h.


Member Function Documentation

void add_length ( int  increase )

Adjusts the _length_increase variable so the snake's length gradually increases.

Parameters:
Thebody units that the snake will eventually grow to

Definition at line 121 of file SnakeBody.cpp.

void init (  )

Initialises the body.

Definition at line 19 of file SnakeBody.cpp.

void reset (  )

Resets body variables so game can be replayed.

Definition at line 133 of file SnakeBody.cpp.

void run ( Gamepad &  pad,
N5110 &  lcd,
bool &  _death 
)

Runs the appropriate functions for the body.

Parameters:
Gamepad
LCD
_deathis the flag for if there is a collision (in this case snake-snake)

Definition at line 125 of file SnakeBody.cpp.