How do I spawn a sprite at position of a specific textstring

Get help using Construct 2

Post » Sat Feb 28, 2015 4:18 pm

Hi. Is it possible to somehow get the position of a letter or string inside a textobject or spritefont object? I know you can get the index where the string was found but is there a way to get the X and Y position? Something like "Press [B] to start" and [B] will be replaced with an image of a B button and the text will be replaced with "" to show only the button/sprite. Would be nice to show some images inside a text. :)
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
58
S
18
G
6
Posts: 756
Reputation: 9,591

Post » Sat Feb 28, 2015 6:28 pm

I am not sure if I got you right, but I give it a try! You could create a SpriteFont and replace some letters with images - have a look on the .capx! I replaced "Z" with an image and wrote "ZUTTON" to create the String! I erased small letters and numbers from the spritefont - you could use all the numbers to put images instead of them, for example! Or use the small letters, or make different SpriteFonts!

I used blackhornets - SpriteFontGenerator_v2 from this forum to create a spritefont. I opened the spritefont with paint.net and replaced the "Z" with the image! For every "Z" you write with this spritefont the image appear!
You do not have the required permissions to view the files attached to this post.
B
3
Posts: 9
Reputation: 193

Post » Sun Mar 01, 2015 6:34 pm

Thanks. Good idea with Spritefont. :)
This should work in most cases but if you need all chars to display lots of text (a huge wall of text!) is there another way to do it?
Bl4ckSh33p-Soft - Custom Software and Indie Games
B
58
S
18
G
6
Posts: 756
Reputation: 9,591


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests