![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: GameEngine/SnakevsBlock/SnakevsBlock.h
- Revision:
- 59:c65a2e933c47
- Parent:
- 56:142e9fdb77a8
- Child:
- 62:ebf6ecf8a6d5
--- a/GameEngine/SnakevsBlock/SnakevsBlock.h Sun Apr 28 19:40:50 2019 +0000 +++ b/GameEngine/SnakevsBlock/SnakevsBlock.h Mon Apr 29 12:09:31 2019 +0000 @@ -76,25 +76,23 @@ int snakex; //x position of top beed int snakey; //y position of top beed - int length; + int length; //saves the length of the snake, for collision detection relative to it's length and calculations. int velocity; //this is to stop/move the background (food and blocks), when collision occurs at a length greater than 10. - int level; + 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; + int blocknum; // saves the number inside the colliding block, for calculations. int blockgap; //to change frequency of fall - int blockbuff; // to manage the fall of food relative to the blocks - int srn; + int srn; //sr number of the block we are colliding with (1 to 5) int send_block_number; //makes sure that the block number is only updated when send is activated. int back; //enables the player to go back on main menu if back is pressed. - int b[15]; - int b0_to_b14[15]; + int b[15]; //this saves the beed number of the colliding snake, if beed 3 from top was colliding with any obstruction, b[2] will be 1. int *b_number; //pointer to save the numbers inside the block. - Vector2D snake_pos[15]; - Vector2D food_pos[3]; - Vector2D b_pos; + Vector2D snake_pos[15]; //saves the position of all the snake beeds in an array for ease of collision processing. + Vector2D food_pos[3]; //saves the position of all 3 snake food on the screen in a single array for ease of collision processing. + Vector2D b_pos; //saves the origin of the blocks on the screen (this is the top left corner of the block row). private: Snake _s; @@ -106,7 +104,8 @@ Blocks _b; Stats _Setstats; int _speed; - int _length; + 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 _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.