WoochanLee / BalanceTetris

Tetris built with vanilla javascript
9 stars 10 forks source link

redraw() must be called when a shift event called #13

Closed DevSDK closed 3 years ago

DevSDK commented 3 years ago

It might be related to this [1] patch.

This commit is related in [2].

When the shift key is pressed, the current control block is marked as 'isPrevExisted' which means the blocks must be cleared.

Therefore, insert 'redraw()' function in shiftControlBlock() to clear previous blocks and rendering current control-block.

Also, added 'captureCurrentRenderToArray()' function and prevBlockArray to capture current block rendering status for checking difference with 'markDiffToPrev()'

For example case in ControlBlock class:

captureCurrentRenderToArray(this.blockArray, this.prevBlockArray)

/ some blockArray change code /

markDiffToPrev(this.blockArray, this.prevBlockArray)

[1] https://github.com/WoochanLee/BalanceTetris/pull/9/commits/004b49d3b2a76e17c2d120a626be0e2d9df553ff [2] https://github.com/WoochanLee/BalanceTetris/issues/12

DevSDK commented 3 years ago

This commit is related in https://github.com/WoochanLee/BalanceTetris/issues/12