tothniki Posted May 20, 2016 Share Posted May 20, 2016 Helo, i want to make a very simple bomberman game. I made some simple layers in tiled, and load them. Thats OK. I also made an object layer where i used only polylines / ellips to mark the bumper areas. The problem is, that i cant load this object layer and i cant use. I this moment I use a simple layer, so the player can collide with all of the layers' objects, but i need to use polylines / ellips too. So i realy need a solution. Is there any way to solve this problem? (I use ARCADE physics) Thanks for the answers! Link to comment Share on other sites More sharing options...
drhayes Posted May 20, 2016 Share Posted May 20, 2016 There's no direct method in Arcade physics for doing anything with object layers from Tiled. You do have access to it, though. The thing you get back from "game.add.tilemap" is the processed object that Tiled saves. There's an object in that map called "objects". Each of its properties corresponds to one object layer. If you had an object layer named "bumpers", your code would look something like this: const map = this.game.add.tilemap('myMap'); if (map.objects.bumpers) { const bumpers = map.objects.bumpers; bumpers.forEach(bumper => { // do something here with the data console.log(bumper); }); } Link to comment Share on other sites More sharing options...
tothniki Posted May 20, 2016 Author Share Posted May 20, 2016 Quote Thank you very much, now i understand how to use object layer. But how can i set collision all of the object layer's elements in the forEach? - I m searching it in phaser documents, but i cant find. Thanks again! Link to comment Share on other sites More sharing options...
drhayes Posted May 23, 2016 Share Posted May 23, 2016 I don't think you can directly. In my code I'm adding those sprites into groups. Those groups are checked against each other and my collision layer in my state's update method. Link to comment Share on other sites More sharing options...
Recommended Posts