Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
SnakevsBlock/SnakevsBlock.h
- Committer:
- AhmedPlaymaker
- Date:
- 2019-04-08
- Revision:
- 19:05cc9f801468
- Parent:
- 18:b391caa5754c
- Child:
- 22:ee698f66146f
File content as of revision 19:05cc9f801468:
#ifndef SNAKEVSBLOCK_H #define SNAKEVSBLOCK_H #include "mbed.h" #include "N5110.h" #include "Gamepad.h" #include "Snake.h" #include "SnakeFood.h" #include "Blocks.h" class SnakevsBlock { public: SnakevsBlock(); ~SnakevsBlock(); /** Initialise Game Machine * * This function initialises the game machine. */ void init( ); /** Read Input * * This function obtains numeric data from the gamepads joystick. */ void read_input(Gamepad &pad); /** Update * * This function contains the update functions of the other libraries used in the game. */ void update(Gamepad &pad); /** Draw * * This function contains the draw functions of the other libraries used in the game. */ void draw(N5110 &lcd, Gamepad &pad); /** Get Position * * This function contains the Get Position functions of the otehr libraries used in the game. */ void get_pos(); int snakex; int snakey; int length; int level; int foodbuff; //this makes food 1,2,and 3 come at seperate times int blocknum; int blockgap; //to change frequency of fall int blockbuff; // to manage the fall of food relative to the blocks int srn; int send; //makes sure that the block number is only updated when send is activated. int speed; //makes sure that snake only moves if not colliding to block walls int b0; int b1; int b2; int b3; int b4; int b5; int b6; int b7; int b8; int b9; int b10; int b11; int b12; int b13; int b14; int b0_to_b14[15]; private: Snake _s; SnakeFood _f; SnakeFood _ff; SnakeFood _fff; Blocks _b; int _speed; Direction _d; float _mag; int n; /** Check for Snake and Food collision * * This function checks if the Snake has come into contact with it's food. */ void CheckSnakeFoodCollision(Gamepad &pad); /** Check for Snake and Block collision * * This function checks if the Snake has come into contact with any Block. */ void CheckSnakeBlockCollision(Gamepad &pad); /** Check for Snake and Block Sides collision * * This function checks if the Snake has come into contact with any the sides of the block and stops it moving. */ void CheckSnakeBlockSidesCollision(Gamepad &pad, Direction d); }; #endif