Auto resizing Text object

This forum is currently in read-only mode.
From the Asset Store
OpenAI TTS
$10 USD
Text-to-Speech plugin.Allows your Construct 3 project to convert written text into spoken words
  • Evening guys its me your favorite "H'n'S" section spammer! i am firing my lazzers again!

    So, in many games you propable seen ToolTips. You know, when you hover your mouse over an weapon, item, spell, skills ect it gives you its brief description and its stats. But diffrent objects have diffrent infromation amount. Item Shovel with absolutly no use in game will have just the name and maybe weight, when a "Legendery Brutal Battle Axe of Indescribeble Doom +14 made by Chuck Norris" will not only have a very long name, but wall of text of stats, buffs, description and other juicy stuff which fanatical gamers love to see/read.

    my problem is so the text object would adjuct its size depending on how much actual text is displayed. i know about the "newline" expression but in my case its off topic as i want to attach a nice graphic background for the tooltip and link its size with the size of text object.

    now how can this be done?

    i know that i can just make diffrent ToolTip objects for diffrent ToolTip types, like big one for weapons which has many stats and text, smaller for shields, and dfirrent for devices. is there a way to LOCK text object width or heigh and force it to expand to remaining direction?

    i am also aware that instead of "text object" based ToolTips i can just use pre-made images - but you know, one TextObject + one image + couple of variables will always weight less then any other two images. and the diffrence is perhaps small when we're talking 10 tool tips. but imagine 1000 tooltips. thats 1k pre-made images. even if they would be 1kb each thats 1000 times more then what would weight TextObject based ToolTips. Not talking about the amount of work. with Text you just change the text and the rest is done by the engine. with images you need to insert the text, adjuct the size by auto, save it, import it to Construct (even as a frame not object) and then remember WHICH frame was the ToolTip for that blasted Bannana Space Thrusters

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Maybe you can cook something with this :

    Len(string)

    Returns the number of characters in the string.

    Check the number of characters in the tooltip text and then adjust the text object's size and frame size?

    You'd probably have to know the width and height of the police you're using though.

    aaah i don't know i'm just a noob ^^:

    Edit : Or maybe you can try to do it the html/css way : make small images for the corners (or just one since you can rotate it), and one for the frame itself that would be stretched or repeated until it fits the size of the tooltip. Because if you use 1 image only it would be blurred. And then add a Tiled Background.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)