zetsubou Posted December 4, 2018 Share Posted December 4, 2018 Hi! I have a dynamic layer consisting of coins, that player is supposed to collect throughout the whole game. My goal is just remove tile on overlap with a player. I tried a couple of solutions I found. These are: const groundTileset = map.addTilesetImage("tile1", "ground_objects"); const batteries = map.createDynamicLayer("battery", groundTileset, 0, 0); // the first solution i tried batteries.setTileIndexCallback(7, playerAbsorbsBattery, this); // and the second one this.physics.add.overlap(player, batteries, playerAbsorbsBattery, null, this); Using a second one causes collision with everything i have on map, so its always invoked until i remove all tiles(so I need to somehow specify (objects || tiles || sprites), thats it collides with?) And i tried similar solution on labs.phaser - didn't help. Link to comment Share on other sites More sharing options...
zetsubou Posted December 4, 2018 Author Share Posted December 4, 2018 Well, i figured out how the second one works out(that was obvious though). I just set an overlap with a layer, that apparently fits in all map. Link to comment Share on other sites More sharing options...
zetsubou Posted December 4, 2018 Author Share Posted December 4, 2018 Spent 4 hours searching for a solution and in a complete desperation decided to create a topic to ask for help. And then, in 5 minutes I just solved it. map.setTileIndexCallback(7, playerAbsorbsBattery, this); Thought i checked this one, but apparently I had not. Guess this topic might be deleted. Link to comment Share on other sites More sharing options...
samme Posted December 4, 2018 Share Posted December 4, 2018 Did you use physics.add.collide then? Link to comment Share on other sites More sharing options...
zetsubou Posted December 6, 2018 Author Share Posted December 6, 2018 @samme, nope, that was it. Back then i just forgot to add overlap for batteries. Link to comment Share on other sites More sharing options...
rafaelasantos Posted December 11, 2018 Share Posted December 11, 2018 Hey Can you please help me I'm trying to do the same but the code simply doesnt do nothing Link to comment Share on other sites More sharing options...
Recommended Posts