I've been implementing a Voronoi module in order to compute a map composed of randomly generated Voronoi cells, here is what it looks when I use the godot-built-in _draw()
function.
My goal is to set up clickable polygons for a stategy game, one per province - I guess, even if this idea might be questionable.
My first approach was : generate a CollisionShape based on each cells' corners (given by the module), then a RigidBody2D and add the CollisionShape as a child of it. At this point I have no idea how to connect the input (as a mouse click) of the RigidBody2D, because this newly generated RigidBody2D obviously doesn't have a script. I thought that instantiating a general-purpose RigidBody2D scene with a script might be the solution, but I'm afraid that I would a heavy process to instantiate dozens, not to say hundreds, of scenes.
I guess another approach could be to use an UI texture button but I thought that 2D nodes were a cleaner and more appropriate solution, mainly because of the static nature of UI, but I may be completely wrong.
An ultimate but important point is that I need to be able to draw each polygon texture procedurally, I would like to implement a biome system, with cells as sea and moutain among others.
If you have any idea, knowledge or advice, it would be very appreciated.
Thanks for reading :)
post-scriptum : here is my project's code so far, to give an idea: