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
Diff: SnakeTail/SnakeTail.h
- Revision:
- 13:4fa0d5148216
- Parent:
- 11:c4b740a970f8
--- a/SnakeTail/SnakeTail.h Sun May 24 14:19:21 2020 +0000
+++ b/SnakeTail/SnakeTail.h Sun May 24 15:08:31 2020 +0000
@@ -6,20 +6,34 @@
#include "N5110.h"
#include "SnakeHead.h"
+/** Snake Tail class
+@brief Class to update and draw the tail of the snake
+@author Samuel D Lashmar
+@date May 2020
+*/
+
class SnakeTail
{
public:
-
+ /** Constructor */
SnakeTail();
+ /** Destructor */
~SnakeTail();
+ /** updates the position of all the tail sgements
+ @param 2D vector of previous head coordinates
+ @param length of the tail
+ */
void update(Vector2D headPos, int length);
+ /** draws the tail on the LCD screen
+ @param length of the tail
+ */
void draw(N5110 &lcd, int length);
private:
-
+ //two 100 element arrays for storing the x and y coordinates of the tail segments
int tailX[100];
int tailY[100];
int _x_init, _y_init, prevX, prevY, prev2X, prev2Y, _length;