Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: GameObjects/SnakeFood/SnakeFood.cpp
- Revision:
- 56:142e9fdb77a8
- Parent:
- 51:387249f9b333
- Child:
- 63:205f0ca48473
--- a/GameObjects/SnakeFood/SnakeFood.cpp Sat Apr 27 18:56:30 2019 +0000 +++ b/GameObjects/SnakeFood/SnakeFood.cpp Sun Apr 28 16:56:08 2019 +0000 @@ -23,12 +23,11 @@ } -void SnakeFood::draw(N5110 &lcd, int blockbuff) +void SnakeFood::draw(N5110 &lcd) { velocity.x = 0; velocity.y = 1; - _blockbuff = blockbuff; //add sideways velocity incase I want to make it dodgy. @@ -40,9 +39,7 @@ if(n == 0){ _fx = (rand() % 82); //this makes the food pop up at a random, unspecified location in the x axis. _fy = -3; - if(!((_blockbuff <= 11)&&(_blockbuff >= -11))) { //this makes sure that the snake food only appears when the block doesn't cover it. - n = n+1; - } + n = n+1; } lcd.drawSprite(_fx,_fy,3,3,(int *)food_sprite); //Function to draw the sprite. @@ -71,7 +68,4 @@ { _fx = p.x; _fy = p.y; - if(((_blockbuff <= 11)&&(_blockbuff >= -11))&&_fy == -3) { //this makes sure that the snake food only appears when the block doesn't cover it. - n = 0; - } }