Label help

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • So... in my ship game you can zoom out. And each ship don't has a label (Ship name, position, etc.) but you zoom out and the text is unreadably small. Any ideas for a fix?

  • So... in my ship game you can zoom out. And each ship don't has a label (Ship name, position, etc.) but you zoom out and the text is unreadably small. Any ideas for a fix?

    Place ship name, position etc. in something else and don't let zoom effect it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Moving to Help/Tech

    Place ship name, position etc. in something else and don't let zoom effect it.

    Well, that's real specific. Do something, something, and don't let it zoom

    Anyway, you could try a couple of different ways. If you set the text labels on a separate layer, then when you zoom out the lower layer the coordinates for the un-zoomed layer will be off. You will need to position your text label coordinates as a percentage of the ship layer coordinates rather than a straight one to one pixel ratio. So if your ship layer is zoomed out to 50%, your text label coordinates will have to be half what the ship coordinates are. In other words, if your ship's coordinates are 50, 180 then your text label will have to be 25, 90, etc.

    The second way you could try it would be to scale the text up as you zoom the layer out. That might get a little tricky with text objects, so you might want to look into using the SpriteFont object, which should allow you to scale the sprites up. I'm not entirely sure it would work flawlessly without a lot of tweaking, but it's something to try.

  • The math for this is actually more complicated than multiplying the object's position by the zoom percentage to find the text position, but I'm too lazy to explain the reasoning behind that right now. The formula should be as follows(this might break under certain conditions, I haven't fully tested it yet):

    X = ScrollX + (SpriteX - ScrollX) * (ZoomX / 100)

    Y = ScrollY + (SpriteY - ScrollY) * (ZoomY / 100)

    Here's an example:

    Zoom Follow Thingy

    I hope this helps.

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