• 2D
  • Puzzle game. When clicking on a object, a clone of it should pop up, and go to the right

Hello! I want to make a clone of Doodle God game (puzzle-alchemy genre), for learning purposes only.

I want to implement the functionality from the following video: 2:40 - 2:45

Here, when we have the elements classes in the middle of the screen, and we click on an element class, all element classes go to the left, and a clone of the clicked element class goes to the right.

I implemented the part with the element classes going to the left. But I don't know how to implement the part with the clone of the clicked element class that goes to the right.

Initially, I thought to create a clone of each element class to be underneath them, and to be set as invisible. And when I click on the desired element class, the clone of it will turn visible and go to the right. But here I noticed a problem with the collision shapes. Because they overlap each other, I don't know if I have access to both of them during the gameplay. When I tried this tactic, I remember that I had access only to one collision shape.

Now I am thinking of creating a clone of the object at run-time. But I don't know how optimal will be this.

How should I implement this? Is any of this tactics good or should I try something different?

You can disable collision shapes that you don't need. Since you're creating only one clone of the shape at a time, it will not be a big issue for optimization, so don't worry about that.

4 days later

Ok, now I'm trying one more time the variant with the clone created manually (not at run-time).

20 days later

Hello! I solved this using the tactic with clones created manually.

I found out that two collision shapes are just areas, and two overlapping collision shapes are just a surface and they can't perform any inconvenience to each other.

Therefore, by clicking on that surface of two overlapping collision shapes, by using a signal from collision_shape1, I can manage the object1, and by using a signal from collision_shape2, I can manage the object2.

In fact, when I click on the overlapping objects, I receive signals from both objects. So, here is all about managing signals.

And that's how I solved this problem, by using the signals from each collision shape.