Selecting tiles in isometric tilemap with variable height

Hello,
I am creating a game that involves an isometric tilemap and would like the player to be able to use a mouse to select individual tiles. Currently, I am using a transformation matrix similar to this one. However I have run into a problem as my tiles have a variable height. To illustrate this issue, I have created the following image (current tile boundaries are marked with the red grid).

Is there a way around it?

Cheers,
Tomires

1 Like

It looks like the height might be handled by doing a simple vertical offset. Make sure you test in front-to-back order to cater for partially covered tiles.

2 Likes

@sicher has provided a solution I think, but I just wanted to say that it’s nice to see an isometric game done using Defold! What kind of game are you doing?

2 Likes

I think I’ve got it - I will analyse neighbouring tiles on click (height difference between two tiles next to each other won’t be higher than 2*constant as the tile further from the viewpoint wouldn’t be visible nor selectable & there would be issues regarding character animation) and then proceed from front to back taking into account the offsets of individual tiles. Thanks!

@britzl It’s for a turn-based RPG with certain edutainment elements :wink: We have only just started production after a couple months of analysis.

2 Likes

Cool, good luck! I’m looking forward to seeing the finished product. Please let us know if you have any progress to share or a project webpage or blog.

1 Like

Thanks for the support!

Not at the moment, we plan to establish those as we near the prototype stage in the coming months (I expect to dedicate more time to the project over the course of summer as I have some errands to attend to at the moment - namely university [a nasty course on linear algebra] and one software project outside of gaming :smiley: )

2 Likes

Hey there,

I’m working with hex maps, and i was wondering how you set up the tilemap to not be a square grid.

Currently i’m working with each tile being a gameobject, so i can place them “programmatically” but i would like to use a tilemap.

Thanks in advance!

K

1 Like

Hello,

I am not using Defold’s tilemap components, sorry for the confusion.

My workflow is as follows: I create a tilemap in Tiled (which support hexagonal tiles btw), export it as a lua file and then import the file into my project. Individual tiles are represented as game objects created by a factory, which is probably the same method that you are using.

AFAIK there is no other way to utilize non-orthogonal tiles using Defold’s internal tools, but it shouldn’t be that difficult to use our workaround.

Are you making a turn-based RTS like Civ or Wesnoth by any chance? :slight_smile:

2 Likes

Hey there!

Sorry for late answer and thanks for yours :slight_smile:

We are doing the same then.

I’m working on a hack n’ slash on a hexgrid (with A* for movements).

I actually have a decent module i could share to manage hex tiles.

Cheers!

2 Likes