Jump to content

P2JS and Relatively Positioned Group Children


Sunburned Goose
 Share

Recommended Posts

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.
 
mDj1DNbl.png
 
a5EK69Cl.png
 
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);
 
lp4psIBl.png
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...