Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: GameObjects/Snake/Snake.h
- Revision:
- 87:871d9fecb593
- Parent:
- 83:329da564799a
- Child:
- 96:1ab67b3e6898
--- a/GameObjects/Snake/Snake.h Tue May 07 00:02:11 2019 +0000 +++ b/GameObjects/Snake/Snake.h Wed May 08 16:39:24 2019 +0000 @@ -1,5 +1,5 @@ -#ifndef Snake_H -#define Snake_H +#ifndef SNAKE_H +#define SNAKE_H #include "mbed.h" #include "N5110.h" @@ -39,19 +39,19 @@ * * This function updates the Snake sprite position on screen. */ - void update(Direction d, int* b); + void update(Direction d, int* immobile_bead_n); /** Chain Snake Together * * This function makes all of the snake beeds chained together by making the lower ones drag towards where the top one was in the previous loop */ - void chainSnakeTogether(int* b); + void chainSnakeTogether(int* immobile_bead_n); - /** Moove Snake + /** move Snake * * This function makes the controls of W/E directions only exclusive to the top beed in the snake */ - void mooveSnake(Direction d, int* b); + void moveSnake(int* immobile_bead_n); /** Set Snake Limits * @@ -66,13 +66,14 @@ Vector2D get_pos(int snakeIndex); int reset; - int b[10]; //each element in this array represents the beed number in the snake. + int immobile_bead_n[10]; //each element in this array represents the beed number in the snake. private: int _speed; //this is the speed of the snake flowing in the x axis. int _x[10]; //each element in this array represents the x position of each beed in the snake. int _y[10]; //each element in this array represents the y position of each beed in the snake. - int _length; + int _length; //stores thee length of snake to be drawn or managed in terms of structure. + Direction _d; //Stores the direction the snake moves in. //Pointer to the game pad object pad. Gamepad *_pad;