flx sort between tilemap and a flxsprite

63 views
Skip to first unread message

Ali Hassan

unread,
Dec 12, 2015, 4:38:18 PM12/12/15
to haxef...@googlegroups.com


i am trying to add y sort to a game i am curruntly working on .. so i added all my objects including the tile maps into a big flxtypedgroup and added it to the playstate .. but the problem is that it seems to work between flxsprites and each other only .. however i am not able to sort the tiles in the tilemap with the player ..you can find a screenshot attached
is what i am saying even possible now in haxeflixel .. or am i doing something wrong here ?


 



`

Screenshot from 2015-12-12 23:35:34.png

Jeru Sanders

unread,
Dec 13, 2015, 6:41:26 PM12/13/15
to HaxeFlixel
You cannot sort tiles and players. Tilemaps combine the tiles as a single object to save resources. You'd have to make the walls objects for that effect.

Mixer

unread,
Dec 14, 2015, 7:46:56 PM12/14/15
to HaxeFlixel
That's not actually entirely true, there is a far neater solution without resorting to creating objects. Just use different layers in your tile maps, one for the foreground, one for the background. To have a look at loading multiple layers, take a look at the Tiled demo source code. From that, you can just add the background layer, then the player, then the foreground layer.

Jeru Sanders

unread,
Dec 16, 2015, 3:13:40 PM12/16/15
to HaxeFlixel
That works, but you could dig yourself into a hole with that pretty quick. If you do that then you can only have the object above the player, and since he's sorting in realtime I expect he wants the object to switch layers in realtime. You could also fix that by dynamically changing the tilemaps to update the layering, but then if you have multiple player/enemy you want to also be sorted this no longer works.

It's a good solution in an extremely static game, but it scales really poorly to more dynamic games.
Reply all
Reply to author
Forward
0 new messages