Ahmed Adamjee
/
SnakeVSBlock
Snake vs Block Game to be run upon K64F.
Diff: GameObjects/Barriers/Barriers.cpp
- Revision:
- 94:4e603bd6c381
- Parent:
- 83:329da564799a
- Child:
- 95:b068b0735f45
diff -r 7f9c31ed5cab -r 4e603bd6c381 GameObjects/Barriers/Barriers.cpp --- 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.