![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Final Submission. I have read and agreed with Statement of Academic Integrity.
Dependencies: mbed Gamepad N5110 Joystick
Snake/Snake.cpp
- Committer:
- el16dlc
- Date:
- 2019-05-09
- Revision:
- 3:660de4311976
- Parent:
- 2:0bd6711eae26
- Child:
- 10:aedca0082855
File content as of revision 3:660de4311976:
#include "Snake.h" Snake::Snake() { } Snake::~Snake() { } void Snake::init() { _snake_posX = WIDTH/2 - 2; // Snake head set to horizontal centre _snake_posY = HEIGHT/2 - 2; // Snake head set to vertical centre } void Snake::draw_head(N5110 &lcd) { lcd.drawRect(_snake_posX,_snake_posY,4,4,FILL_BLACK); // Draws snake head } void Snake::set_snake_posX(int snake_posX) {_snake_posX = snake_posX;} // mutators allow changing snake position void Snake::set_snake_posY(int snake_posY) {_snake_posY = snake_posY;} // accessors int Snake::get_snake_posX() { return _snake_posX; } int Snake::get_snake_posY() { return _snake_posY; } void Snake::set_food_posX(int food_posX) {_food_posX = food_posX;} // mutators allow changing snake position void Snake::set_food_posY(int food_posY) {_food_posY = food_posY;} // accessors int Snake::get_food_posX() { return _food_posX; } int Snake::get_food_posY() { return _food_posY; } void Snake::draw_food(N5110 &lcd) { lcd.drawRect(_food_posX,_food_posY,4,4,FILL_BLACK); }