Jump to content

Enabling physics on parents & children


Recommended Posts

Hey, I'm new to Phaser and running into some trouble getting my bounding boxes to play nice. I'm making a game involving bees and trying to attach a stinger child to the bee parent like so: 

this.beeSprite1.addChild(game.make.sprite(0, 50, assets.stinger1.name));

which successfully attaches the stinger to the bee. My problem is that when I try to use 


to to turn on physics (and thus collision) for both of them, I run into problems. The stinger sprite will remain oriented to the bee, but the bounding box will appear at the screen coordinates 0, 50 as a separate physics object. Interacting with it will cause the sprite to move, but moving the sprite by moving the bee that it's attached to won't affect the bounding box. If I try to make the stinger kinematic, the sprite will stay put, but the bounding box will still be stuck at the screen coordinates 0, 50. 

The end goal is to have the stinger be a separate hitbox from the bee, but I'm (clearly) not sure if this is the best way of going about it. Is there something about anchoring bounding boxes that I'm missing, or should I be pursuing this in a different way?

Link to comment
Share on other sites


  • Recently Browsing   0 members

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