I'm in a bit of a spot with a mechanic I want to implement for a grid based puzzle game.
I've been trying to approach it through different means, but nothing so far has worked.
Essentially, I have created instances of block sprites that can move in a grid like fashion within four directions. You start off moving one sprite around at a time, and can change to the next one and so on by pressing space. I want to add a mechanic where if you move next to another sprite, they will 'combine'. I've set up some raycast2D to detect the collision, but i've been stumped on the combination part for a while.
Its a bit more complicated than it seems because I want each sprite to maintain control of its movement, while following those it has combined with. Also, managing other sets of combined sprites that must combine with another set. It's kind of like jelly no puzzle, but I dont want to totally combine the sprites since i want to maintain individual control over each of them. The later idea would be that the current sprite in control of its set can spin the whole set as a center axis.
I've tried making changed the sprites parent and child structure. Creating signals and groups to manage the movement. Using arrays. Copying the position of the following sprites to the one in control, and nothing has worked for me.
If you have a suggestion or want to play around with it to see what I mean you can download the project here.
Thanks in advance.