Sunburned Goose Posted May 9, 2014 Share Posted May 9, 2014 Is it a known behavior of child sprites that are positioned relative to a positioned parent group have their physics and collision boundaries based on the relative positions in the game world?var myGroup = game.add.group();myGroup.enableBody = true;myGroup.enableBodyDebug = true;myGroup.physicsBodyType = Phaser.Physics.P2JS;myGroup.x = 1700;myGroup.y = 1700;var mySprite = myGroup.create(0,0,texture);mySprite.x = 0;mySprite.y = 0;mySprite.body.static = true;mySprite.body.clearShapes();mySprite.body.setCircle(mySprite.width / 2);When I do this, it looks like this, with the texture showing up at 1700,1700 but the boundaries are at 0,0. What it should look like is this when I change the coordinates, var myGroup = game.add.group();myGroup.enableBody = true;myGroup.enableBodyDebug = true;myGroup.physicsBodyType = Phaser.Physics.P2JS;myGroup.x = 0;myGroup.y = 0;var mySprite = myGroup.create(0,0,texture);mySprite.x = 1700;mySprite.y = 1700;mySprite.body.static = true;mySprite.body.clearShapes();mySprite.body.setCircle(mySprite.width / 2); Link to comment Share on other sites More sharing options...
Sunburned Goose Posted May 10, 2014 Author Share Posted May 10, 2014 Is it a best practice to absolutely position a group or should a group always be at 0,0? Link to comment Share on other sites More sharing options...
Recommended Posts