Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: GameEngine/SnakevsBlock/SnakevsBlock.h
- Revision:
- 63:205f0ca48473
- Parent:
- 62:ebf6ecf8a6d5
- Child:
- 64:540aa1602372
diff -r ebf6ecf8a6d5 -r 205f0ca48473 GameEngine/SnakevsBlock/SnakevsBlock.h --- a/GameEngine/SnakevsBlock/SnakevsBlock.h Tue Apr 30 14:53:38 2019 +0000 +++ b/GameEngine/SnakevsBlock/SnakevsBlock.h Wed May 01 22:35:40 2019 +0000 @@ -43,6 +43,18 @@ * This function obtains numeric data from the gamepads joystick. */ void read_input(Gamepad &pad, FXOS8700CQ &device, int gm); + + /** Calculate Tilt + * + * This function reads the angle of tilt required for motion contol and also processes it by reseting the angle buffer if A is pressed. + */ + void calculateTilt(Gamepad &pad, FXOS8700CQ &device); + + /** Light The LEDS + * + * This function ligths the LEDS dependent on the direction of travel. + */ + void lightTheLEDS(Gamepad &pad); /** Draw * @@ -54,7 +66,13 @@ * * This function contains the update functions of the other libraries used in the game. */ - int update(N5110 &lcd, Gamepad &pad, SDFileSystem &sd); + void update(N5110 &lcd, Gamepad &pad); + + /** Check Game Progression + * + * Function handles level progression and level failure operations by using the class WinLoose. + */ + int CheckGameProgression(N5110 &lcd, Gamepad &pad, SDFileSystem &sd); /** Get Position * @@ -81,7 +99,6 @@ int level; // this is diffrent to int _length as this stops at 10 to not complicate collisions as the snake doesn't grow longer than 10 visually. char bufferlevel[14]; //this helps me print the level on screen. int garbage; //to save the angle at the point button A is pressed. - float angle; //saves the angle of tilt. int foodbuff; //this makes food 1,2,and 3 come at seperate times int blocknum; // saves the number inside the colliding block, for calculations. int blockgap; //to change frequency of fall @@ -109,6 +126,7 @@ int _length; //this is diffrent to the int length as this saves the length of the snake, for collision detection relative to it's length and calculations. int _maxLength; // this makes us go to the next level if if maxLength is achieved; Direction _d; + float _tiltAngle; //saves the angle of tilt. float _mag; int _detect_slowly; //this makes sure that when the length is more than 10, the colliding block doesnt decrease the all the length in a single itteration. int n; @@ -137,6 +155,12 @@ */ void CheckSnakeBlockSidesCollision(Gamepad &pad); + /** Make Default Motion Free + * + * This function makes the default motion of the snake freemoving before a collision is checked for, to forget the previous collision. + */ + void MakeDefaultMotionFree(); + /** Check Collision in Y axis * * This function checks if the Snake and blocks collide anywhere in the Y axis.