Hello,
I've been perusing the forums to look for a problem related to this. I understand that each TMXLayer is an AtlasSpriteManager and that each tile is an AtlasSprite.
What I've done is make a tilemap that has several layers.
Layer 0: "Under ground filler"
Layer 1: Collision
Layer 2: Ground
Layer 3: Player
Layer 4: Above player
So how the map in theory was supposed to work is that I'd drop a tile on the collision layer anywhere we wanted to stop movement against an item that is seen on the Ground layer, and anything that we wanted a player to be able to walk "behind" would be on the "above player" layer, and the actual atlassprite that represents the player would be on the "Player" TMXlayer. Previously the sprite was being drawn by its own AtlasSpriteManager, it appeared & worked fine.
I've moved the sprite into the TMXLayer, and I'm having trouble even seeing it. I had assumed that a layers ordering would also correspond with the Z order in which its drawn, but I can't for the life of me manage to make the sprite appear (its definitely being drawn)
self.tileMap = [ TMXTiledMap tiledMapWithTMXFile:@"ProtoMap.tmx" ];
[ [ tileMap layerNamed:@"Player" ] addChild:[ [ [ [ someAppController sharedController ] mUnitController ] playerUnit ] mySprite ] z:1 ];
I've tried it with a z from anywhere to 0 to 5000. My camera is bound to the sprites position, so when I move it, my camera still moves but.. no player to be seen anywhere. The only thing I can think of is the mention that each tile is drawn its own z, so the top left is z:0 and the bottom right is z:max. But, that doesn't make much sense in terms of drawing, by the time you got to the bottom right corner of a map, your ground layer would be like z:9000, and then if you had another tile (In another layer) on top of it, wouldn't it have to be atleast z:9001, or does that not matter because its a different layer and its already implied to be "on top" of the previous layer? If that were the case, then my sprite should appear without any tweaking, since its layer sits on top of the other layers already, and there are no layers above it except in a few places (tree tops etc)
This seems pretty straight forward. Any suggestions on what I'm missing?