L
L
lemma2018-03-12 18:04:24
JavaScript
lemma, 2018-03-12 18:04:24

How to make (and is there a ready-made tool) the transformation of a 2d map into an array of strings?

I'm trying to write a trial game in JS, and so I came across the fact that it would be more convenient for me to draw a level by 1 tile and then convert the drawn map into an array of strings. It would be interesting to write it myself, but I have absolutely no idea where to start. Or are there already open source solutions?
Example:
You draw something like this
5aa6969485c76746833568.png
And it transforms into something like this
5aa696b9b039a266863687.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stepan Krapivin, 2018-03-12
@xevin

There is such a tiled editor that
can save in json and xml formats

T
twobomb, 2018-03-12
@twobomb

I did something like this once , well, it's the other way around. And about tiles to text, I once wrote a toy in ActionScript3 (flash) with the box2d engine. So I used the Tiled program, it saves data in xml, or rather its own .tmx extension. And this map can already be parsed.

J
JackShcherbakov, 2018-03-12
@JackShcherbakov

I could be wrong, but you can just make this field for drawing a table, and then go through which row (tr) and write a certain value to the array, then the same thing, but with a trace, washing. That's all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question