I’ve been tinkering with a tile-based game that has “landing zones” for tiles that can be swapped. In general there are three requirements:
- The tile that is dragged needs to know which tile is underneath it when released (mouse/touch drag) and which “zone” that new tile is in that it has landed upon. That is so it can swap itself out and then re-evaluate the score in the zone where it landed.
- The tile that it has landed upon needs to be swapped into the previous tile’s origination point and that similarly triggers a re-evaluation of that zone’s score that it landed in.
- I need to animate the resting/seated tile to “teleport/travel” to the landing area/zone of the dragged tile to show the player that it moved and was swapped.
I was looking around in some of my old apps, and even though it is a “Word Game”(which isn’t exactly my game concept) I actually think Dabble is the best parallel to what I’m describing:
- Dabble (Gameplay): https://youtu.be/bOGljsXnu5M?t=5
I got the dragging and dropping working with TextureRect’s since they inheret from Control objects (that wasn’t too bad), but I’m now having a hard time conceptually figuring out how to replace the tiles, keep track of the landing zones (though they should be an array of positions/locations on the board which can house and snap-to tiles, basically). And then have to have those tiles “snap to” a grid of slots/zones like you see up in Dabble when the user releases the mouse or lifts finger from device.
Not looking for a solution, but some pseudo-code to get me going down the right path would be super helpful.
I’ve tried Grids, ItemLists, etc. but I’m so new to Godot I’m not sure which is right way to go.
Thanks in advance for your help!