How do I get neighbor tiles through code in Hexagon Tile?

Godot Version




The current plan is to use Tilemap to do spreading simulation.
The deep blue is an occupied tile, the light blues are the tile to check next update: if it’s not occupied or had collision, make it turn deep blue.
This is probably not the most efficient simulation, but my end goal is an animation for video essays so whatever works.

Anyway, to get an idea of how the Hexagon coordinate works, I set up some simple code, and uh…

I have no idea what to read here.
There’s also different kinds of layout, which just from reading the doc I can’t tell what’s the point.
I can probably use set_cell to experiment something out of here, but it’s pretty late where I live, so I’ll just post here and hope for an easy out tomorrow…

I have an Hexagon tilemap, and an coordinate of a tile. How do I get the 6 neighbor’s coordinate?
Thanks for reading.

In this episode of: Is there a function? It turned out to be yes!

1 Like