Creating tiled maps in-memory, instead of from paths? #4

Closed
lvh opened this Issue Mar 2, 2014 · 3 comments

Comments

Projects
None yet
2 participants

lvh commented Mar 2, 2014

I'm trying to create a hex map. I can't do so from a file, because the versions of Tiled that actually supported hex map editing appear to have been lost in history. If I want to create a regular tiled map (not from a file), do I just use clojure's java interop to create these objects and pass them along? It appears tiled-map*, which all the helper functions use, was written with this in mind, because it acts as the identity function when its argument isn't a string. This just isn't the standard documented way of using those functions. Right?

Would there be any desire perhaps to just have nullary versions of the same functions create empty maps? That does leave us with the issue of the scale argument... I was kind of expecting it to work more like:

(orthogonal-tiled-map (load-map "level1.tmx") (/ 1 8))

rather than:

(orthogonal-tiled-map "level1.tmx" (/ 1 8))

But perhaps it is too late to mess with these APIs?

lvh commented Mar 2, 2014

(The other reason I don't want to load from a file is because I'm hoping to procedurally generate the maps :))

Owner

oakes commented Mar 2, 2014

Yeah I intentionally had tiled-map* return the argument if it wasn't a string, so you could pass your own TiledMap object that you create with java interop. I haven't documented it, but there's nothing wrong with doing it that way. If there's a way I can make it easier in play-clj, let me know.

Owner

oakes commented Apr 4, 2014

I just added the ability to create new tiled maps, layers, and cells like this:

(tiled-map*)
(tiled-map-layer* width height tile-width tile-height)
(tiled-map-cell*)

You can run methods on them with the relevant functions like tiled-map!. I'll close the issue, but let me know if there's anything else that is missing for making tiled maps programmatically.

oakes closed this Apr 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment