Jump to content

Sprite Body with P2


flo71099
 Share

Recommended Posts

Hi everyone,

 

I've got a problem about P2 body.

 

I've got a group who contains sprites with body enabled.

/*...*/this.game.physics.startSystem(Phaser.Physics.P2JS);/*...*/this.myGroup = new Phaser.Group(this.game);item = new Phaser.Sprite(this.game, x, y, 50, 'sprite');this.game.physics.p2.enable(item, true);this.myGroup.add(item);

When I move the group like bellow

this.myGroup.x = 100;this.myGroup.y = 100;

Sprite move the right way, but not his body ! .. and that is my problem :/

 

what is the right way to make the body following the sprite ?

 

 

post-13301-0-97051900-1426704373.png

Link to comment
Share on other sites

ZoomBox, this wouldn't work, or at least not the way I expected.

I've got many items in my group, I want their positions to be relative to the group.

 

there is no way to "add" sprite.body to a group ?

 

Nikow, a Group doesn't have a body, this  wouldn't work too.

 

 

To be clearer about what I'm trying to do, I've a group containing items, I want my world size to be group size + 1000 and then position my group to the center of the world.

So, everything work well except the bodies which don't seems to be attach to the group.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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