Tile based interaction, how to structure the game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By sciencetourist
:warning: Old Version Published before Godot 3 was released.


I started off with my first project on godot.
The game can be described as a tile based game where you have to search things inside of a building. It should also be turn based. In each turn you can perform a number of actions such as move and interact by clicking on the tiles.
I also want to implement a fog of war and something like a max sight distance. So the tiles are only “visible” if you already visited them and they are in range of your sight.

My problem here is how to setup the structuwith them.
The alternative would be simple Sprites instead of a Tilemap but then random map generation would be a lot of effort I think.

Maybe someone ran into the same problem.


TileMap gives you a grid of tiles, but you aren’t limited to use just this. You could make your game as a combination of tilemap and other things, but to know which, you need to first define your requirements / problems.

For example, clicking a tile to interact with it: which tiles can you actually click on? If it’s actually a handful of objects, then you can place them as nodes. But you could also get which tile is under the mouse and do an action accordingly.

Also if you use a mix of tilemap and nodes, your fog of war could be a second tilemap drawn over the first one so it would be able to hide nodes too.

Which problem do you have specifically?

Zylann | 2017-10-23 13:07

Thank you, I will look into the action based on which tile is under the mouse.

My setup looks like this:
enter image description here

The Tilemap displays my background. And mousecontrol is a Button moved by the mouse movement and snapping to the tile grid. It has the general behaviour I want to now.
But you only get left clicks that way, I need to find out how to right click a button.

enter image description here

sciencetourist | 2017-10-23 13:45

I found a solution for right clicking.

sciencetourist | 2017-10-23 16:36