🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Crystal Swapping

Published January 21, 2024
Advertisement

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.

This is the auto-swapping between two different crystals. A Draggable can be seen towards the top.

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 popup appears whenever attempting to drag a crystal to another of the same type.

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.

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement