![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: GameObjects/Blocks/Blocks.cpp
- Revision:
- 95:b068b0735f45
- Parent:
- 83:329da564799a
--- a/GameObjects/Blocks/Blocks.cpp Wed May 08 23:36:12 2019 +0000 +++ b/GameObjects/Blocks/Blocks.cpp Thu May 09 08:35:02 2019 +0000 @@ -277,8 +277,8 @@ { _lcd = lcd; reset = 0; - _bx = NULL; - _by = NULL; + _bx = -100; //to make sure these coordinates do not interfere with any collisions as this is a default value if conditions do not satisfy, + _by = -100; //(NULL is in range of collisions in this game and is therefore not used. } @@ -382,13 +382,13 @@ return blockpos; } -int * Blocks::get_number() //Obtains the X and Y coordinate of the target. +int * Blocks::get_number() //Sends the array of all the numbers saved inside the blocks. { return caseselect; } -void Blocks::update(int blocknum, int blockgap, int srn, int send_block_number) //send sends the block number only when the y position satisfies a particular requirement +void Blocks::update(int blocknum, int blockgap, int srn, bool send_block_number) //send_block_number sends the block number only when the y position satisfies a particular requirement { //and srn gives the srn of the block, snake is colliding with. // this if function makes sure the block appears at the rate of blockgap. if(_by >= (blockgap)){ @@ -397,7 +397,7 @@ _bx += velocity.x; _by += velocity.y; - if(send_block_number) {caseselect[srn] = blocknum;} + if(send_block_number == true) {caseselect[srn] = blocknum;} }