Objects are rectangles, but the shapes are not

I think I may have hit a brick wall with this one. I have two shapes, T and U. Both shapes are made up of 5 squares, so the T rectangle is 3x3 and the U rectangle is 3x2:

  []     ()  ()
  []     ()()()

Since the objective of the puzzle is to fit the pieces in the “tray”, the T and the U must be fit together:

      []()  ()

The problem is once the pieces are in this position, the rectangles overlap. If the user clicks on the overlapping area, then both pieces are “selected”.

Is there anyway to have Gdevelop only look at the filled in pixels of the object and ignore the invisible ones when the user is clicking on an object (I already have the “hit boxes” correctly defined)?


What size are the pieces (in pixels)? It should still work if they are larger as long as the images have constrained proportions and then the grid can be adjusted to the same size so you can place them where they need to be easier.

I tried it with some of my 32 x 32 px platform tiles and they fit together, I just can’t test if this would work with the code. I believe it’s possible to make it recognize filled areas using the object coordinates and true/false conditions or actions.


Each square in the piece is 80x80 pixels. Fitting them together isn’t the issue - that works fine. The problem is figuring out which piece the user meant to click when the overall rectangle surrounding the piece overlaps with another piece:


If the user clicks on the area shown with the cross-hatch, the “If Cursor/Touch is on …” condition will flag both the U and the Z shape as true, when it should only flag the U shape. I think this may be because Gdevelop assumes a click area that is rectangular and not irregular as I need it. If there were a way to use the Hit Box settings, then I could make this work, but I have a feeling that Gdevelop isn’t robust enough to handle this situation.

Thanks for your assistance,

as or your shapes are based in squared figures maybe you could use small squares objects linked to form the whole figure

Don’t know if this would help

@xisco - thanks for the idea, but when I tried it, I had a problem keeping the squares attached when the user drags the ‘shape’ into a new location. It also makes rotating and flipping the shape very difficult. I’m going to try the following:

  • user clicks on a shape
  • invisible object is moved to cursor location
  • test for collision (since the hit maps can be defined to match the shape)
  • use the collision condition to determine which shape was actually clicked on
    This may take some time to figure out, since I’m very new to Gdevelop, but so far, Gdevelop has proven to be the fastest package to come up to speed on. Godot is amazing, but way to complex for what I need. Most of the other packages require Python or Python-like scripting (which I could learn, but would be difficult to hand off to a non-programmer), so I’m going to give this one more try before I give up on Gdevelop.