Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: GameEngine/SnakevsBlock/SnakevsBlock.cpp
- Revision:
- 81:4c1641e10dcd
- Parent:
- 80:51ca38c5dcdf
- Child:
- 82:c51ae8a501d1
--- a/GameEngine/SnakevsBlock/SnakevsBlock.cpp Mon May 06 08:00:56 2019 +0000 +++ b/GameEngine/SnakevsBlock/SnakevsBlock.cpp Mon May 06 09:05:09 2019 +0000 @@ -49,6 +49,8 @@ _ff.init(); //food 2 object initialisation. _fff.init(); //food 3 object initialisation. _b.init(); //block object initialisation. + _barA.init(); //barrier A object initialisation. + _barB.init(); //barrier B object initialisation. } void SnakevsBlock::read_input(Gamepad &pad, FXOS8700CQ &device, int g_mode) @@ -121,6 +123,12 @@ if(_dropbuff >= 80) { _fff.draw(lcd); //Draws the first food after a loop delay of 80. } + if(_dropbuff >= 22) { + _barA.draw(lcd, b_pos.y); //Draws the first set of blocks after a loop delay of 8. + } + if(_dropbuff >= 40) { + _barB.draw(lcd, b_pos.y); //Draws the first set of blocks after a loop delay of 8. + } if(_dropbuff >= 8) { _b.draw(lcd, _length); //Draws the first set of blocks after a loop delay of 8. } @@ -142,6 +150,8 @@ _ff.update(); _fff.update(); _b.update(blocknum, blockgap, srn, send_block_number); + _barA.update(blockgap); + _barB.update(blockgap); }