atomicptr / openfl-tiled

openfl-tiled is a library which gives OpenFL developers the ability to use the TILED map editor.
Other
45 stars 21 forks source link

Allow "frozen" and layers with accessible tiles #52

Open johnhattan opened 10 years ago

johnhattan commented 10 years ago

As I understand it, an openfl-tiled map (at least in Flash) consists of a single big bitmap containing all layers flattened together. While that's great for terrain or walls or other immutable tiles, it's not friendly for stuff that can change, like open-able doors or collect-able objects or monsters. Putting something in a map that can move or change would require (a) some kind of "refresh a single square" command that I don't think exists or (2) a hack like putting all move-able objects on invisible layers so you can manually add individual sprites for all movable objects or (3) never adding a map to the stage and just writing my own map-builder using the underlying layer/tile data.

Not sure if there's a layer property for it, but it'd be nice if I could say "these layers are frozen" which would make one big flattened bitmap of those layers or "these layers are dynamic" which will make a sparse array of individual sprites.

Apologies in advance if I'm futzing with the design. I've been using openfl-tiled for all of one day and am just looking how things would interact with my design :)

atomicptr commented 10 years ago

Since 0.4 I've removed the old "createBitmapData..." methods which allowed you to build your own map with several layers (e.g. draw the layer [0, 2, 4] "frozen" and do some dynamic stuff with the others or whatever). I often use the object groups for dynamic content.

Since 0.4 there is no method for drawing specific layers which is something I intend to change in the future. For now the only way to add dynamic content is to use the TiledMap, Layer and Tile objects.

Actually the whole rendering stuff is something I originally didn't intended to do in openfl-tiled so the API design still needs some work in this regard ;).

johnhattan commented 10 years ago

Okay, no prob. The rendering stuff seemed fairly simplistic compared to the rest of the objects, so it seems like the preferred method is to just deal with the underlying data myself.

And thanks for writing this thing. It's saving me the hassle of writing a level editor :)

atomicptr commented 10 years ago

The rendering stuff is something I'm breaking very often since I'm not really sure how to make this really neat.