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.
Food/Food.cpp@5:a3a9e0417e04, 2018-04-29 (annotated)
- Committer:
- Andrew_M
- Date:
- Sun Apr 29 18:03:45 2018 +0000
- Revision:
- 5:a3a9e0417e04
- Child:
- 7:c1e0593bfc99
Food class is now a thing, the snake grows when it eats and a game over state is reached when the snake eats it's own tail with a simple animation to demonstrate the game over state has been reached
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Andrew_M | 5:a3a9e0417e04 | 1 | #include "Food.h" |
Andrew_M | 5:a3a9e0417e04 | 2 | |
Andrew_M | 5:a3a9e0417e04 | 3 | // nothing doing in the constructor and destructor |
Andrew_M | 5:a3a9e0417e04 | 4 | Food::Food() |
Andrew_M | 5:a3a9e0417e04 | 5 | { |
Andrew_M | 5:a3a9e0417e04 | 6 | |
Andrew_M | 5:a3a9e0417e04 | 7 | } |
Andrew_M | 5:a3a9e0417e04 | 8 | |
Andrew_M | 5:a3a9e0417e04 | 9 | Food::~Food() |
Andrew_M | 5:a3a9e0417e04 | 10 | { |
Andrew_M | 5:a3a9e0417e04 | 11 | |
Andrew_M | 5:a3a9e0417e04 | 12 | } |
Andrew_M | 5:a3a9e0417e04 | 13 | |
Andrew_M | 5:a3a9e0417e04 | 14 | void Food::init(int x, int y) |
Andrew_M | 5:a3a9e0417e04 | 15 | { |
Andrew_M | 5:a3a9e0417e04 | 16 | //Inital values for variables |
Andrew_M | 5:a3a9e0417e04 | 17 | _x = x; |
Andrew_M | 5:a3a9e0417e04 | 18 | _y = y; |
Andrew_M | 5:a3a9e0417e04 | 19 | } |
Andrew_M | 5:a3a9e0417e04 | 20 | |
Andrew_M | 5:a3a9e0417e04 | 21 | int Food::getX() |
Andrew_M | 5:a3a9e0417e04 | 22 | { |
Andrew_M | 5:a3a9e0417e04 | 23 | return _x; |
Andrew_M | 5:a3a9e0417e04 | 24 | } |
Andrew_M | 5:a3a9e0417e04 | 25 | |
Andrew_M | 5:a3a9e0417e04 | 26 | int Food::getY() |
Andrew_M | 5:a3a9e0417e04 | 27 | { |
Andrew_M | 5:a3a9e0417e04 | 28 | return _y; |
Andrew_M | 5:a3a9e0417e04 | 29 | } |