stnight99 Posted November 26, 2015 Share Posted November 26, 2015 I still struggling on overlap handler on phaser, I have this code on create function:this.changelevel = this.map.createLayer("changelevel")this.map.setCollisionBetween(1,78, true,"changelevel")and this code on update function:game.physics.arcade.overlap(this.player,this.changelevel,this.something)the something property only returns console.log('lol'), and i expect it will only fire if the player sprites overlaps on the changelevel layer. But everytime i start the game, the callback function always fire. Please help me to understand the overlap method on a tilemap object. Thanks Link to comment Share on other sites More sharing options...
Zangarian Posted January 3, 2016 Share Posted January 3, 2016 I'm late but I hope this can help. I discovered this problem today. The docs say for overlap : "Unlike collide the objects are NOT automatically separated or have any physics applied, they merely test for overlap results". When you usethis.map.setCollisionBetween(1,78, true,"changelevel")it's related to physics, and it's useful with collide, but overlap is not related to physics. So, I think the test is "is the sprite overlapping on the whole layer (the screen) ?". The answer is always "yes". One solution is to test overlapping between sprites. For example, you can find help to create sprites from json files here : https://gamedevacademy.org/html5-phaser-tutorial-top-down-games-with-tiled/. Link to comment Share on other sites More sharing options...
Recommended Posts