alps56 Posted January 9, 2014 Share Posted January 9, 2014 Hi, all, I have learned Phaser for a couple of days. I have encountered a weird problem. In the create() section, this.sets = this.game.add.group(); // sets is a group this.sets.x = this.game.world.centerX; this.sets.y = this.game.world.centerY+40; this.player = this.sets.create(0, 0, 'player'); // add player to sets this.arrow = this.sets.create(0, -220, 'arrow'); // add arrow to sets this.arrow.body.immovable = true; this.sets.setAll('anchor.x', 0.5); this.sets.setAll('anchor.y', 0.5); In the update() section, this.game.physics.collide(this.player, this.arrow); When the player move to the arrow, the collision works well.But when I rotate the sets, the collision does not work, the player and the arrow can be overlapped. Any ideas? Thanks a lot. Link to comment Share on other sites More sharing options...
alps56 Posted January 10, 2014 Author Share Posted January 10, 2014 Sorry, I mean AFTER rotate, the sprites belong to the group do not detect collision Link to comment Share on other sites More sharing options...
4ucai Posted January 12, 2014 Share Posted January 12, 2014 On my experience before, rotating the sprite does not rotate the it's body. Try to render it on canvas and call "render" and see where the body of your sprite, is, to get a better idea.game.debug.renderSpriteBody(sprite1); Link to comment Share on other sites More sharing options...
rich Posted January 12, 2014 Share Posted January 12, 2014 Right, I would imagine the bodies are appearing elsewhere now. Do as 4ucai above says and then you'll see where the bodies actually are in relation to the sprites. Link to comment Share on other sites More sharing options...
Recommended Posts