Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Sun May 05 23:48:57 2019 +0000
Revision:
79:35cb65c52d25
Child:
83:329da564799a
Fixed a bug where the snake wouldn't move if its length is 1. Also sorted out Collision functions so that they perform tasks independently.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AhmedPlaymaker 79:35cb65c52d25 1 #ifndef LENGTHMANAGER_H
AhmedPlaymaker 79:35cb65c52d25 2 #define LENGTHMANAGER_H
AhmedPlaymaker 79:35cb65c52d25 3
AhmedPlaymaker 79:35cb65c52d25 4 #include "mbed.h"
AhmedPlaymaker 79:35cb65c52d25 5 #include "N5110.h"
AhmedPlaymaker 79:35cb65c52d25 6 #include "Gamepad.h"
AhmedPlaymaker 79:35cb65c52d25 7
AhmedPlaymaker 79:35cb65c52d25 8 class LengthManager
AhmedPlaymaker 79:35cb65c52d25 9 {
AhmedPlaymaker 79:35cb65c52d25 10 public:
AhmedPlaymaker 79:35cb65c52d25 11
AhmedPlaymaker 79:35cb65c52d25 12 LengthManager();
AhmedPlaymaker 79:35cb65c52d25 13 ~LengthManager();
AhmedPlaymaker 79:35cb65c52d25 14
AhmedPlaymaker 79:35cb65c52d25 15 /** Initialise LengthManager
AhmedPlaymaker 79:35cb65c52d25 16 *
AhmedPlaymaker 79:35cb65c52d25 17 * This function sets the initial length parameters.
AhmedPlaymaker 79:35cb65c52d25 18 */
AhmedPlaymaker 79:35cb65c52d25 19 void init();
AhmedPlaymaker 79:35cb65c52d25 20
AhmedPlaymaker 79:35cb65c52d25 21 /** Minus Length
AhmedPlaymaker 79:35cb65c52d25 22 *
AhmedPlaymaker 79:35cb65c52d25 23 * This function decrements the length value by 1;.
AhmedPlaymaker 79:35cb65c52d25 24 */
AhmedPlaymaker 79:35cb65c52d25 25 void MinusLength();
AhmedPlaymaker 79:35cb65c52d25 26
AhmedPlaymaker 79:35cb65c52d25 27 /** Plus Length
AhmedPlaymaker 79:35cb65c52d25 28 *
AhmedPlaymaker 79:35cb65c52d25 29 * This function increments the length by one.
AhmedPlaymaker 79:35cb65c52d25 30 */
AhmedPlaymaker 79:35cb65c52d25 31 void PlusLength();
AhmedPlaymaker 79:35cb65c52d25 32
AhmedPlaymaker 79:35cb65c52d25 33 /** Draw
AhmedPlaymaker 79:35cb65c52d25 34 *
AhmedPlaymaker 79:35cb65c52d25 35 * This function draws the length on the screen.
AhmedPlaymaker 79:35cb65c52d25 36 */
AhmedPlaymaker 79:35cb65c52d25 37 void print_length_on_screen(N5110 &lcd);
AhmedPlaymaker 79:35cb65c52d25 38
AhmedPlaymaker 79:35cb65c52d25 39 /** get the length
AhmedPlaymaker 79:35cb65c52d25 40 *
AhmedPlaymaker 79:35cb65c52d25 41 * This sends the current length value when called.
AhmedPlaymaker 79:35cb65c52d25 42 */
AhmedPlaymaker 79:35cb65c52d25 43 int _getLength();
AhmedPlaymaker 79:35cb65c52d25 44
AhmedPlaymaker 79:35cb65c52d25 45 /** Set the Length
AhmedPlaymaker 79:35cb65c52d25 46 *
AhmedPlaymaker 79:35cb65c52d25 47 * This function obtains the length value to be altered.
AhmedPlaymaker 79:35cb65c52d25 48 */
AhmedPlaymaker 79:35cb65c52d25 49 void _setLength(int length);
AhmedPlaymaker 79:35cb65c52d25 50
AhmedPlaymaker 79:35cb65c52d25 51 private:
AhmedPlaymaker 79:35cb65c52d25 52 int _length;
AhmedPlaymaker 79:35cb65c52d25 53
AhmedPlaymaker 79:35cb65c52d25 54 };
AhmedPlaymaker 79:35cb65c52d25 55 #endif