How do I set an object's position to right after the Text

Get help using Construct 2

Post » Thu Jun 18, 2015 5:31 pm

I have a text object. I have a "coin" sprite that should appear right next to it. Problem is: The text is dynamic, which means the object will change size depending on the number of characters the current text have. I want my "coin" sprite to appear on the right side of the text objetc, right next to it. How do i do it?

My best guess was to set the position of the sprite to textObject.X + len(textObject.Text), but it is appearing over the textObject(i guess it´s because the length of the text object isn't so long enough)
B
5
S
1
Posts: 27
Reputation: 425

Post » Thu Jun 18, 2015 5:47 pm

try

textObject.X + len(textObject.Text)*8

assuming the letter width is 8 pixels/letter
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Thu Jun 18, 2015 5:55 pm

wow! It really worked! Thank you very much, RamPackWobble! I just changed the 8 to 9 because it was better for me, but it worked ^^
B
5
S
1
Posts: 27
Reputation: 425


Return to How do I....?

Who is online

Users browsing this forum: leena222, mindragon73, tatogame and 22 guests