mdix Posted September 20, 2013 Share Posted September 20, 2013 Hi, first of all: Thank you very much for Phaser! Its just great how much work you keep away and how much fun you give to the developer. I just have a brief question: I built a map with Tiled. The map has 3 layers. The third layer contains the elements the 'player' has to collide with. I loaded the map via tilemap() and added a player sprite via sprite(). Both are displayed, everything works fine. I used 'setCollisionRange' to the tile numbers that occur in layer3 (the colission layer) and in my update() method I call (game.physics.collide(player, map)). I checked my code twice and, concerning the colission, it does exactly the same thing as starstruck (examples/games/starstruck.php). The only difference I found was that the starstruck tilemap (assets/games/starstruck/level1.json) has only one layer. Is multiple layer collision detection implemented at present? If so, what am I doing wrong? Thanks for your trouble and kind regardsMarc Link to comment Share on other sites More sharing options...
rich Posted September 20, 2013 Share Posted September 20, 2013 At present it can only collide with one layer. So although you can have multiple layers for presentation there's only one "collision layer" so to speak. Link to comment Share on other sites More sharing options...
mdix Posted September 21, 2013 Author Share Posted September 21, 2013 Hi rich, thanks for your answer. How can I tell phaser which layer is my collision layer, or is it the first / last layer? Kind regardsMarc Edit: Ok, I checked the map obj. and it seems to be the last defined layer and it now works. Thank you very much.Edit2: So there's just a short question: How can I get a specific layer to render after my player sprite has been rendered? Currently all three layers are rendered before the player object (the player object is above everything). Link to comment Share on other sites More sharing options...
rich Posted September 21, 2013 Share Posted September 21, 2013 Tile map has a property called collisionLayer, which can be set to any of your layers, visible or not.There is no way to inject sprites between layers right now, but it's on the list. Link to comment Share on other sites More sharing options...
mdix Posted September 21, 2013 Author Share Posted September 21, 2013 Hi rich, thanks for your help. We need that feature really bad, because we need to place the sprite (character) behind other tiles. What do you think: When will this feature be available? We need to check if we can keep Phaser (and we would, because we love the community) or use another framework. Kind regardsMarc Link to comment Share on other sites More sharing options...
rich Posted September 21, 2013 Share Posted September 21, 2013 There's no reason why you can't just use 2 tilemaps on-top of each other, with one layer each. Link to comment Share on other sites More sharing options...
rnzr Posted February 28, 2014 Share Posted February 28, 2014 Is the feature to inject sprites between layers already implemented? Link to comment Share on other sites More sharing options...
woofers Posted April 30, 2014 Share Posted April 30, 2014 Has a feature to have more than one collision layer in a single tile map been added? hellojenny 1 Link to comment Share on other sites More sharing options...
Recommended Posts