Detect object click on isometric map

Hello!

In our game we have isometric map. It looks like:


Click #1 should return me object_id = 1
Click #2 should return me object_id = 2

There is a good example with collision objects:

But I can’t understand how can I assign collision shape to game object, when I create it with lua:

local id = factory.create("#object_factory", pos, null, { object_id = object_id })

Each object in object_factory has its own shape. Any ideas how can I deal with it?


Tnx!

2 Likes

I would create a different object factory for each object (and put the collision object inside the prototype object that each factory creates). Or have i misunderstood the question?

You’d have to access the z-layer to work out if click 1 is on object 1 or object 3. And be careful… that way of doing things is going to make clicking on the small house in tile 3 very difficult!

Good idea, I’ll test it. But is it ok to have 500 object factories? :slight_smile:

I don’t think it will have much of an impact performance wise. You can increase the default cap of 128 factories in game.project in the Factory section.

PS I love the graphics by the way!