Final Submission. I have read and agreed with Statement of Academic Integrity.
Dependencies: mbed Gamepad N5110 Joystick
Diff: Snake/Snake.cpp
- Revision:
- 10:aedca0082855
- Parent:
- 3:660de4311976
--- a/Snake/Snake.cpp Thu May 09 11:36:21 2019 +0000 +++ b/Snake/Snake.cpp Thu May 09 13:52:41 2019 +0000 @@ -1,5 +1,6 @@ #include "Snake.h" +// constructor and destructor empty Snake::Snake() { } @@ -15,28 +16,39 @@ 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 +// this method allows changing the horizontal snake position +void Snake::set_snake_posX(int snake_posX) {_snake_posX = snake_posX;} + +// this method allows changing thevertical snake position void Snake::set_snake_posY(int snake_posY) {_snake_posY = snake_posY;} -// accessors +// this method gets the horizontal position of snake int Snake::get_snake_posX() { return _snake_posX; } + +// this method gets the vertical position of snake 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 +// this method allows changing the horizontal position of food +void Snake::set_food_posX(int food_posX) {_food_posX = food_posX;} + +// this method allows changing the vertical position of food void Snake::set_food_posY(int food_posY) {_food_posY = food_posY;} // accessors +// this method gets the food horizontal position int Snake::get_food_posX() { return _food_posX; } + +// this method gets the food vertical position int Snake::get_food_posY() { return _food_posY; } void Snake::draw_food(N5110 &lcd) { - lcd.drawRect(_food_posX,_food_posY,4,4,FILL_BLACK); + lcd.drawRect(_food_posX,_food_posY,4,4,FILL_BLACK); // draw food } \ No newline at end of file