d3ucalion Posted September 7, 2015 Share Posted September 7, 2015 I recently noticed an issue when updating from Phaser 2.3 to 2.4.3. To recycle bullets when they encountered the layer, I was using: this.physics.arcade.overlap(this.bullets, this.layer, this.bulletHitLayer, null, this);However after updating, it resulted in the bulletHitLayer function getting called and killing the bullet immediately after it was revived (before it had actually overlapped the layer). Changing this to: this.physics.arcade.collide(this.bullets, this.layer, this.bulletHitLayer, null, this); resolved the issue, as collide still works as it always has. I'm not sure if this is a bug related to overlap, or if I missed something regarding overlap in the change logs. It's not a huge problem as both accomplish the same thing for this circumstance, however there are times where I do need to use overlap instead of collide. I am primarily wondering what changed since 2.3 to cause this issue. I have setup a demo site on Cloud 9 below which you may access to review the issue. This is not my full game but a demo site I setup to test the issue. https://preview.c9.io/d3ucalion/phasertest1/index.html Link to comment Share on other sites More sharing options...
d3ucalion Posted September 8, 2015 Author Share Posted September 8, 2015 I should also note that this issue occurs in Chrome 44 and Firefox 40. In the demo above the bullet should be moving to the pointer but is instead immediately killed. The demo is using arcade physics, I have included my update loop and the callback function below. update: function() { this.physics.arcade.collide(this.player, this.layer); //this.physics.arcade.collide(this.bullets, this.layer, this.bulletHitLayer, null, this); this.physics.arcade.overlap(this.bullets, this.layer, this.bulletHitLayer, null, this); this.playerMove(); }, bulletHitLayer: function (bullet){ bullet.kill();}, Link to comment Share on other sites More sharing options...
twitch2641 Posted November 22, 2015 Share Posted November 22, 2015 I'm having the exact same issue. I upgraded from 2.2.x to 2.4.x and my bullets are always registering a collision with the layer when using .overlap. When using the below code, killBullet() function is ALWAYS called directly after a bullet is created. Changing this to .collide fixes the issue however I'd prefer to use .overlap since it's less resource intensive.this.game.physics.arcade.overlap(this.world.blockedLayer, this.bullets, this.killBullet, null, this); Link to comment Share on other sites More sharing options...
Recommended Posts