![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | picnic |
I’m new to Godot and have just started working through the beginner tutorials to get a feel for how things work. My objective is to port a couple of 2D ‘world generation’ routines that I’ve written in other languages. They generate data in the form of a 2D arrays of objects, describing the tile/spritesheet frame, movement speed, passability etc. Pretty much like a random map in a ‘roguelike’.
I’m sure bringing the code into GDScript wouldn’t be too difficult but what type of node should I attach the script(s) to and how would I access the array from elsewhere when it comes to drawing the tiles? Would it make sense to put the world generation into its own scene and if so can variables be accessed from other scenes or do they need to be global (if such a concept exists, I haven’t got as far as learning about scope in Godot yet!).
I’ve skimmed through this page Using tilemaps — Godot Engine (3.0) documentation in English but that deals with pre-defined/hand-drawn maps. I also glanced at a Godot roguelike ‘tutorial’ on github but it seemed to be a bunch of source files rather than any sort of explanation.
Any help appreciated