@D-Ring said:
Working on a companion app for a project and the main part of the app is going to be a tile map maker. The users will be able to build/export a map. I know how to make a tilemap for an app, but not sure the approach to take to make a tilemap editor. Here is my general thoughts and questions:
Approach: Draw the grid on screen and have a tile selection window that they can select which tile to paint with, assign the tile to a var and wherever they click do some math to figure out the square and place that tile there.
Seems pretty straight forward but I cause Im new to Godot and still learning best techniques for everything not sure what is the best way to draw the grid on screen? Looking to either have them be able to expand or just be limitless and as they scroll and place things it grows
Well. I would do it like this : Draw grid. Have cursor node, cursor node will follow mouse but it will snap to size of grid (I knew the equation to create function to round numbers to size of grid. I will look for it later), when button is pressed you will add tile to actual tilemap node(According to docs, there is set_cell and set_cellv methods). When you finish editing map, you click something like "save" button. Save button will call method on autoload node. Method on autoload mode will flush all editor related things(like cursor or editor gui), then you pause game but autoload node will be set to process mode so it can continue and instantiate all game related nodes. Pausing game before adding nodes is good idea, otherwise, game may start just created level, but you don't want to have edin-and-play editor because isn't 90' anymore. You can save it using SceneTree.current scene to get scene to variable and then save it to maps folder with help of ResourceSaver and yes, scenes are considered resources as long as they are files, and ther are .tres files. This way, player can create hell of maps, save them all to 10TB raid disc and play any of them any time. You can create "Play custom map" window where it scans all files in maps folder, show them and make scene files clickable and playable.
Damn ! I'm genius ! I should copiright this idea ..... Nah, you are good, use it if you want.
Note : All this was written out of my head and there is no guarantee it will work. It is just idea of concept. I guess you speaking about 2D, this might work in 2D but I'm unsure about how it would work in 3D
-Garrom