So Many Overlaps

March 9, 2025

Trying to get all the swaps and overlaps to work perfectly was incredibly difficult. In the beginning, swapping simply meant an instantaneous flip-flop of two actors’ positions, which was easy but felt cold and sterile. Introducing sliding made the game livelier, but it also brought a host of issues that needed to be handled on a case-by-case basis. For example, if your hero moves so quickly that two enemies are set to share one location, the code must recognize this situation and designate a “winner” (the sliding enemy closest to the destination tile). The “loser” then aborts its current path, adopts a new behavior, and upon reaching the overlapped destination, redirects to the winner’s previous location, ensuring that no two actors ever occupy the same tile.

It’s not quite perfect, but compared to where it was I’m happy it’s working as well as it is.



Leave a Reply

Your email address will not be published.

*
*
*