Hey, guys, sorry for the delay. I’ve been out of town for the weekend.
@tonshadow:
You should probably just destroy and rebuild maps as the player goes from section to section. I would recommend first loading the map data for each map, or, if you have a lot of maps, for each map directly “adjacent” to the current map (where the player can reach it by going through only one door). The actual building of the map is pretty fast, and is really a constant amount of time - once the data’s been loaded, building a million-tile map and building a five-tile map takes about the same time. So destroying a map and rebuilding it when the player goes through a door shouldn’t be a problem.
@Aatos Media:
For my game, I’m doing the same thing. I’m using the dev branch’s object culling, so I added an object listener which creates/destroys the “real” object (created programmatically) when the object’s “host” object is created or destroyed. I encapsulated it into a part of my game’s engine, so now I can define an object type and just say how to create it and how to destroy it, then the game engine finds objects with that particular type and tacks on the listener. This probably won’t be really necessary; I’m having to use culling 'cause I’m planning on having hugely enormous “zones”. If your maps aren’t overly big or don’t have too many objects, you should be able just to create the object as you wrote. Don’t forget to insert the object into the object’s “host” object’s layer.
@c.noeth:
What you might be looking for is edge modes. Add a property to whatever layers you want to wrap around (tile layers only, currently), “edgeModeLeft/Right/Top/Bottom”, and set it to “wrap”. Then, when the map moves past its edge, the tile layer will wrap around instead of stopping at the edge. Other values are “stop” (the default) and “clamp” (repeat the tile at the edge).
@Painconfess:
Do not remove the object and replace it with the new one. This is just asking for bugs - as Dusk advances and object culling becomes non-dev-branch, objects might have special properties, culling will break, errors will occur, and your app will disintegrate into a pile of smoking debris. Sorry for such harshness, but I don’t want you to use an approach which will break soon… You can just leave the object where it is and make it invisible, or you can make it a data object (!isData!). Doing that should keep things working well into the future :).
@Painconfess #2:
!isSprite! shouldn’t be there, all you need is anim:enabled and anim:options. Make sure the animation options are correct.
@Aatos Media #2:
If you need some code for replacing objects, let me know and I’ll get some together.
Dusk supports animations from Tiled via properties; it doesn’t currently support the animation editor or collision editor (good gosh, I didn’t even know that existed! Dusk needs to keep up! :D)