This week I spent my time finishing development on the crystal swapping mechanics. These mechanics are present during the run whenever the player picks up a new crystal or has leveled up.
There are a few possible combinations of gameplay and decision elements that need to be accounted for in code. The system works by dragging one crystal to another slot. The code needs to account for the occupancy of the slot that was dragged to, the type of crystal that is in that slot, and whether the dragged crystal is a Draggable or not. A Draggable is an object that is queued and needs interaction from the player in order to be resolved. Draggables are currently implemented as buffs or crystals. Once the queue is empty, the game resumes play.
This week, I needed to refactor to account for Draggables as well as the case where the dragged crystal is placed in an occupied slot of the same crystal type. If this happens, we want to ask the player whether he wants to supercharge the occupied slot’s crystal and delete the dragged crystal, or if the two crystals should swap. The “supercharge” system will be a system that I will be implementing in the coming weeks that will enhance a crystal's attacks.