MinecraftU / 2021-computer-adventures

Repository for our 2021 Computer Adventures Ruby project!
0 stars 0 forks source link

Allow tetrominos to fall after they've been "saved" by the last chance move before collision detect #46

Closed jamespeilunli closed 3 years ago

jamespeilunli commented 3 years ago

Screenshot from 2021-08-16 11-59-29 See the orange tetromino; it's floating. This is because right when the orange tetromino fell on the purple tetromino, the collision detect gave the orange tetromino a last chance to move out of the way, which it did. But, the collision detect set the orange tetromino to "dead" anyways.

jamespeilunli commented 3 years ago

We can do this by calling collision_detect twice.

jamespeilunli commented 3 years ago

Actually, we don’t have to directly call collision_detect twice. We can just have 2 dead variables, soft_dead and hard_dead, where some logic sets soft_dead to true first, then hard_dead if collision still happens. If not, they get reset to false.

Sorry for no md formatting, I couldn’t find the back tick symbol on my mobile device I’m using to write this comment.