0 votes

Hello,

i am making a 2d isometric action rpg game (like Diablo) with Godot and i want to make my own level editor for it also in Godot. For that i need to load and save my own map files, character sheets and tilesets. Therefore i dont want to use Godot for creating the levels as i want to hand out the editor as well for the players so they can make there own maps with there own character sheets and tilesets. So i don't want to create a .tres file for the tilesets and character sheets, i want to load the animation frames directly from a png file. Also i want to create/load a map file (json) and create the isometric map from there.

I thought i would use json files for the map files, a simple 2D array with the frame number of the tile in the tileset where one tile is 128x64pixels. The map has 3 layers: ground layer, wall/object layer (with depth sorting) and a top layer. The character sheet consists of 128x128 pixel tiles. Each sheet contains animation for idle, walk, attack, hit and death. Each animation consists of 4 frames. There are animations for 8 directions.

My question is, since i don't create the levels and characters within the Godot editor, how do i load them from a file? Is is possible to do such thing?

I only want to code the core mechanics in Godot and do the visual stuff in my own editor (Map creation, placing objects/player/enemies/npc's etc.)

I know how to do such stuff in languages/frameworks like java/libGDX or lua/love2D and so on. But i don't know how to do it in Godot. (Im relatively new)

I switched from lua/love2D because i don't want to write a isometric engine and stuff from scratch again and use all the nice features that are build-in the Godot engine. (Depth sorting is just a click of a button, changing from normal to iso projection is just adusting the camera parameters, there is a animated sprite feature and all that stuff)

in Engine by (24 points)
edited by

1 Answer

0 votes

since i don't create the levels and characters within the Godot editor, how do i load them from a file? Is is possible to do such thing?

It is possible to create all nodes and resources from code. Instanciate their class, set properties, add to the tree. There is is also a way to read and write files using the File class, so yes it's possible.

https://docs.godotengine.org/en/3.1/classes/class_file.html

For JSON you can use the JSON singleton:

https://docs.godotengine.org/en/3.1/classes/class_json.html

For loading images, use the Image class, which supports PNG:

https://docs.godotengine.org/en/3.1/classes/class_image.html

by (29,090 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.