Jump to content

Add Text to Sprite without .addChild


jpperlm
 Share

Recommended Posts

With the removal of the .addChild functionality i'm confused how to add text to a sprite. I'm relatively new to phaser and tried understanding how to do this with containers but the examples seem to be broken.

Currently I have a physics group that i'm using to make my sprites from.

var group = this.physics.add.group();

let item = group/create(50,50,'star');

let label = this.add.text(20,20,"random",style);

Now if i add these both to a container they don't share physics. Do i need to make a container group and then create the desired physics and interactions relating to the containers as opposed to the sprites?

 

Effectively - what is the best way to add a text snippet to a sprite and have it still follow desired physics and interactions without redeclaring this every time one is created.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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