samjarman Posted June 28, 2014 Share Posted June 28, 2014 Hi! I'd like to have some variable text on my buttons and I'd live to have some text on top of sprites that are subject to the arcade physics. Is there a nice way to tether text to a sprite or button? Maybe put them in the same group, but then can you put these groups into *other* groups? Cheers Link to comment Share on other sites More sharing options...
lewster32 Posted June 28, 2014 Share Posted June 28, 2014 Yes you can put groups into groups into groups as far down as you want to. Handily Sprites can also have things added to them using sprite.addChild(text) - like so:var sprite = game.add.sprite(0, 0, 'button');var text = game.add.text(0, 0, "Some text", {font: "16px Arial", fill: "#ffffff"});sprite.addChild(text);// now text will be positioned relative to the sprite, and will move around with it like a group - except with sprites you can still use physics quiphop 1 Link to comment Share on other sites More sharing options...
Recommended Posts