Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Robster | |
Old Version | Published before Godot 3 was released. |
Hi all,
I’m working on my next game. Breakout / Arkanoid.
I’ve created my first ever tool. A level editor. I can draw out the level, choose which tiles I want, etc etc. Looks great. Works great.
Now I want to be able to save out the data, so I can load it into my game.
I want to write out this kind of info:
[Level]
[Number = 1]
[Brick]
[Location = 0,0]
[Texture = "greenBrick.png"]
[NumHits = "1"]
[Location = 0,1]
[Texture = "greenBrick.png"]
[NumHits = "1"]
[Location = 0,2]
[Texture = "greenBrick2.png"]
[NumHits = "2"]
[Location = 0,3]
[Texture = "greenBrick2.png"]
[NumHits = "2"]
[/Brick]
[Brick]
[Location = 1,0]
[Texture = "redBrick.png"]
[NumHits = "5"]
[Location = 1,1]
[Texture = "redBrick.png"]
[NumHits = "5"]
[Location = 1,2]
[Texture = "yellowBrick.png"]
[NumHits = "1"]
[Location = 1,3]
[Texture = "yellowBrick.png"]
[NumHits = "1"]
[/Brick]
[/Level]
Can anyone offer some advice on what methods I should be following? I looked at CSV at first but can find basically no info RE this in Godot. Then I realised I need better nesting of info anyway so I looked into XML. Looked good but then I noted a lot of reference that JSON format may be best. So then I started looking into that but found not as much info as I’d hoped.
This is basically my first foray into writing files with any real structure and beyond a simple score saving so I’m very new at this.
I wonder, can anyone nudge me in the right direction? Help would be greatly appreciated.