tanmoy749 Posted October 4, 2018 Share Posted October 4, 2018 How can I lebel my sprites with a text when I click on them? I have some different sprites that I need to give different names through clicking on them. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
dude78 Posted October 5, 2018 Share Posted October 5, 2018 @tanmoy749, I just can't understand... Why this (Jobs) topic? Quote Link to comment Share on other sites More sharing options...
tanmoy749 Posted October 6, 2018 Author Share Posted October 6, 2018 Basically I want to attach multiple sprites together through drag and drop. When they are attached I need to give them a name. That's why I need this lebeling option @dude78 Quote Link to comment Share on other sites More sharing options...
dark Posted October 25, 2018 Share Posted October 25, 2018 Here are some snippets from a game I'm working on that has text labels that follow the sprites around. Not the only way to do it, but basically create a text object and make it follow the sprite around. create: function() { label = game.add.text(0, 0, user.name, textStyle); label.anchor.set(0.5); } update: function() { label.alignTo(sprite, Phaser.BOTTOM_CENTER, 0, 0); } Making the text a child of the sprite might also be an option and wouldn't require updating the position every time. In my case my sprites rotate, and the text would also rotate if it was a child. Is that the type of thing you're looking for? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.