HUD scale rate issue

0 favourites
  • 7 posts
From the Asset Store
Use this epic life system with hearts like famous games in your game!
  • Hello guys,

    I'm working on a project for desktop and mobile, and I want some HUD elements to always keep the same size, on any device and with any screen size. For example, the text must stay readable on mobile devices, without getting too big on desktop.

    I read hundreds of times the well-known tutorial "Supporting multiple screen sizes" (https://www.scirra.com/tutorials/73/supporting-multiple-screen-sizes/page-2) but when I try to set my HUD layer's scale rate to 0 to prevent the text from scaling with the game, it just doesn't work : The buttons shrink when I resize the window, and everything is unreadable...

    Can you help me please ?

    PS : English is not my mother tongue, so please correct me if I make mistakes or can't make myself clear

  • I'm having this kind of trouble too, I really can't figure out how to solve it... So please guys help us !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The problem is most likely the difference in PPI between mobile and PCs. As you probably know, the size of the text/sprites is measured in pixels. However, the number of pixels per inch is monstrously different between the two platforms, ie. my laptop computer has a resolution of 1280 x 800 on a 13" screen, while my Samsung Galaxy Tab S has 2560 x 1600 pixels on a 10.5" screen.

    One solution would be to have an event "On Start of Layout" with the action HUDElement > Set Size (insert something like the device's PPI * the desired width in inches, & the same thing for the height) combined with the anchor behavior.

    The device's PPI might be derived from an expression similar to "System.WindowWidth / System.OriginalWindowWidth".

  • Thank you for your quick reply

    I'm not sure your solution will solve the problem, because the HUD scales with the game, when I resize the window on my computer : the game is always displayed on the same screen, I just resize my browser's window, but the screen's PPI doesn't change...

    Edit : I tried your solution just in case, but I was right it doesn't works

  • Are vegapomme27 and I the only ones having issues with this feature, or do the other Construct 2 users have to create a game template for smartphones and another for computers ?

    Does anyone have an example of .capx file where the HUD doesn't scale with the rest of the game ?

  • Are vegapomme27 and I the only ones having issues with this feature, or do the other Construct 2 users have to create a game template for smartphones and another for computers ?

    Does anyone have an example of .capx file where the HUD doesn't scale with the rest of the game ?

    Ratmaster

    No you aren't the only one having this issue. I've run into the same problem. For me, at least I think multiple template is the only answer. If I figure it out, I'll let you know.

  • Thanks flatness , same here

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