BatteryAcid Posted August 21, 2018 Share Posted August 21, 2018 I have a sprite that animates a walk that "dies" when it comes into contact with a bullet. The bullet(s) are just placed on the screen which "overlap" the body of the bad guy, and he "dies". Flipping the sprite's X scale to -1 causes the overlap collision detection to fail for the bullet/badguy. Below is the relevant code, any ideas? Possible bug? this.game.load.spritesheet('badguy-walk', 'images/bad-guy-walk.png', 160, 239); // ... var badGuyGroup = game.add.group(); badGuyGroup.enableBody = true; badGuyGroup.physicsBodyType = Phaser.Physics.ARCADE; var badguy = badGuyGroup.create(400, 400, "badguy-walk"); badguy.scale.setTo(-1, 1); // -1 Breaks collision, 1 works badguy.animations.add("badGuyWalk"); badguy.animations.play("badGuyWalk", 30, true); // ... overlap detection method doesn't fire // the bullet group is a common physics enabled group of sprites this.game.physics.arcade.overlap( badGuyGroup, this.bullets.getBulletGroup(), this.badGuyHit, null, this); Link to comment Share on other sites More sharing options...
samme Posted August 21, 2018 Share Posted August 21, 2018 Use the debug.body() and debug.physicsGroup() methods to show the body boundaries. Link to comment Share on other sites More sharing options...
BatteryAcid Posted August 21, 2018 Author Share Posted August 21, 2018 7 minutes ago, samme said: Use the debug.body() and debug.physicsGroup() methods to show the body boundaries. I do have body debug enabled, the green body box is there as it should be, just nothing happens upon overlap. Link to comment Share on other sites More sharing options...
BatteryAcid Posted August 21, 2018 Author Share Posted August 21, 2018 I couldn't reproduce this using the phaser sandbox so I figured it was some super rare edge case. Decided to reverse animation just using a flipped tile-map image. Link to comment Share on other sites More sharing options...
Recommended Posts