Merge objects with distance when objcet collision


#1

I need to create a game with following functionalities,

  1. when an object(obj 1) collision with the base, it should be linked and then the object needs to move with the base.
  2. New hitpoint is obj 1 top layer.
  3. after the collision a new object needs to created and it falls from top to bottom.
    4.when obj2 hit on the obj1 hitpoint all objects and base need to be linked and move together.

is there any example that I can refer or please help me to build this scenario.
I have tried following code, but

  1. I cannot move objects and base together
  2. cannot increase hitpoint and build the structure of the objects (0bj2 in the top of obj1)

#2

hi, I’m not an expert but think you can use joints. As fas as I know you can check if 2 objects are collisioning, so you could check Y coordinates of each object and maybe X too, to know how are they collisioning.
Then you could use a small object (for example Obj1_collision) linked to Obj1 with another joint (there are examples of this) so Obj1 and Obj1_collision will move together and check collision with obj1_collision.
Hope this helps


#3


#4

take a look here
https://gdevelop-app.com/game-examples-starters/
search for pin object examples


#5

Thank you for your help.