Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
SnakeHead/SnakeHead.h
- Committer:
- sdlashmar
- Date:
- 2020-05-24
- Revision:
- 12:cb3a81adf48b
- Parent:
- 5:256e5e0b6cd7
- Child:
- 13:4fa0d5148216
File content as of revision 12:cb3a81adf48b:
#ifndef SNAKEHEAD_H
#define SNAKEHEAD_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "time.h"
/** Snake Head Class
* @author Samuel D Lashmar
* @brief controls the snake head in the snake game and allows user to access certain variable
* @date May 2020
*/
class SnakeHead
{
public:
/** Constructor */
SnakeHead();
/** Destructor */
~SnakeHead();
/** Initialise snake head position, speed an direction
*@param Snake Head size
*@param Snake Head speed
*/
void init(int size, int speed);
/** Draws snake head on the LCD screen*/
void draw(N5110 &lcd);
/** Updates head position */
void update();
/** Changes the direction in whihc the head moves
@param Direction d (N,E,S,W)
*/
void change_direction(Direction d);
void set_velocity(Vector2D v);
Vector2D get_velocity();
Vector2D get_pos();
void set_pos(Vector2D p);
private:
Vector2D _velocity;
Gamepad pad;
int _size;
int _speed;
int _x;
int _y;
};
#endif