Posted April 16, 2023 by Mystic
When implementing this update there where many challenges. The first was rendering the new "draggable spots" on the screen to show which cells the player could and couldn't drag. I ended up extending the cell renderer to use the same DMII techniques to render the draggable spots.
Next I was able to take implement some extra state logic into level properties and the level editor to enable and disable certain UI based on the play state. Each state followed some pretty simple rules.
Edit Mode - Can place anywhere/ Dragging disabled
Puzzle Mode - Can't place anywhere/ Dragging enabled on draggable spots
Vault Mode - Can place in any non-draggable spots/ Dragging disabled
To get dragging working I simply remove the cell from the cell grid while the user is dragging it, and render a fake cell on top of the users cursor. Then when the user drops the cell onto the cell grid the cell can be placed in its' new spot. As a quality of life feature, if you drop a cell on top of another cell they'll switch places. This was very easy to implement.