jpperlm Posted September 27, 2018 Share Posted September 27, 2018 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 More sharing options...
samme Posted September 27, 2018 Share Posted September 27, 2018 It sounds like you want one physics-enabled container holding the sprite and text. You could use a physics group and add the containers to that, also. jpperlm and Madclaws 2 Link to comment Share on other sites More sharing options...
jpperlm Posted September 27, 2018 Author Share Posted September 27, 2018 Awesome, figured it out with the physics container. Link to comment Share on other sites More sharing options...
Recommended Posts