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).
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.
@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?
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 We have only just started production after a couple months of analysis.
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.
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 )
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?