MennoScholten / RTS2_20220524

1 stars 1 forks source link

Create checkValidMove method in Tetromino class #18

Closed martinreinok closed 1 year ago

martinreinok commented 1 year ago

Instead of checking for collisions in each move method separately, create a Boolean function for all move methods, that doesn't place any tiles, but instead checks if the new position is valid (doesn't collide). This should be for entire Tetromino, instead of a single tile.

This will avoid some graphical glitches that are occurring as currently the collision is checked per each tile individually, meaning it's possible that a tetromino's 3 blocks have moved to new position, while last block can not move, causing all other blocks to move back. Unnecessary work.

martinreinok commented 1 year ago

Done, it removed graphical glitches too. This however can not be applied to rotation yet.