![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: GameObjects/Barriers/Barriers.cpp
- Revision:
- 94:4e603bd6c381
- Parent:
- 83:329da564799a
- Child:
- 95:b068b0735f45
--- a/GameObjects/Barriers/Barriers.cpp Wed May 08 23:08:49 2019 +0000 +++ b/GameObjects/Barriers/Barriers.cpp Wed May 08 23:36:12 2019 +0000 @@ -44,12 +44,12 @@ } -void Barriers::draw(int b_y) +void Barriers::draw(int block_y_pos) { velocity.x = 0; velocity.y = 1; - if((reset == 0)&&(b_y < (_blockgap-14))) { + if((reset == 0)&&(block_y_pos < (_blockgap-14))) { switch(rand()%4) { case 0: _barx = 19; @@ -82,7 +82,7 @@ { _blockgap = blockgap; _barriergap = _blockgap/4; - if (_blockgap <= 60) { + if (_barriergap <= 60) { //to make sure that barrier gap doesn't reduce below 60 which would cause flickering on the screen. _barriergap = 60; } // this if function makes sure the block appears at the rate of blockgap.