I have an extremely basic building spawn code that just gets the click position on the map and spawns a building at that location, irregardless of parenting it to the chunk it spawns on. The best part? This takes place in the _physics_process() of GameMap. I'm eventually going to have buttons in the UI to select which building to spawn, from there, buildings will spawn units, other than the first unit(s) of the game. What better ways of handling the spawning of buildings are there? I'd like to still get the position on and the ID of the chunk to be spawned on, but that can happen in the _physics_process() of any node, right? Should I focus on implementing the UI first, then handle the spawning code in that?

  • xyz replied to this.

    Lousifr Implement first, (over)think later. Code can always be refactored 🙂

    what chunks are you talking about.

    in my code if i needed to spawn items i would just crate a func wich spawns item and put it in unhandled input func, then check if button is pressed and call the spawn func. Then when the ui is done you just connect the button even to the input event or something..

    To get positions, you could keep track of them by creating array/dictionary/list. Idk, im no cheese-tronaut so your millage may vary.

      kuligs2 I have GameMap controlling 6 chunks that have wrap themselves around the camera to act like a flat map projection of the entire globe, except with height. I'm thinking about 7 light years ahead of where I should be, however, and I think the next step would be to create a basic UI.