Tetris: Can drop a block into another block or crash the app
pssandhu opened this issue · 2 comments
Describe the bug
If the drop button is pressed at the correct moment a block can be placed one row inside the blocks beneath it. The app crashes if there is no block underneath.
To Reproduce
- Wait until a block naturally falls into its final place
- Press the drop button before the next block spawns
- If there is already a block underneath, it placed one row deeper than should be possible
- If on the bottom row, the app crashes
Expected behavior
Nothing/skip to next block spawning
Smartphone:
- Android Version: 8.0.0
- Version: 0.6.1
Additional context
Only tested on singleplayer.
From a quick look at the code the problem might the +1
in the loop condition. Might also need to check for a legal move before storeTetronimoInGrid
:
retrowars/core/src/com/serwylo/retrowars/games/tetris/TetrisGameScreen.kt
Lines 158 to 163 in 3c245c4
Can also teleport through blocks if the newY + 1
position is valid and continue dropping.
Can I just say, this is an exceptionally well written bug report, thanks so much for the detail. Very easy to see where the issue is now.
Would you like to have a crack at fixing it? If not I can address it in the coming days.
That's good to hear! I don't have much experience with android development or submitting pull requests but I'll give it a go.