Can the HUD layer be allowed outside the layout?

0 favourites
  • 6 posts
From the Asset Store
Weather Sounds contains 132 sounds from them 64 seamless loops
  • I have created a touch gamepad for mobile players but it has made the HUD a border around the screen. This has led to a bunch if issues, the root of the problems lie with the fact the HUD border renders the edge of the map inaccessablie unless you walk under the HUD.

    First port of call was to make the HUD act like the edge of the layout but the actual edge of the layout is still inaccessible, which is a total deal breaker for my randomly generated terrain. I thought about adding that extra space to the layout and making a border for the layout to match the HUD but every sprite placement is heavily reliant on the background tiles starting at 0,0.

    It's going to take me while to recalculate the layout generation so if anyone has any nifty suggestions in the meantime I'm all ears...

  • So your layout is bigger than window size? How do you scroll it?

    Usually in games like this you add ScrollTo behavior to your character and set Parallax=0,0 for your HUD layer. And that's it, everything scrolls automatically except for the HUD.

  • The layout is fairly big, much bigger than the viewport/window anyway. As you say dop2000 - the player has the scroll to behaviour and the HUD is on a separate layer with 0,0 parallax and the anchor behaviour. So when the player moves, the HUD moves with them. My HUD has been set up as a black border surrounding the viewport/window - Like a screen within a screen, kind of like this: rpgmaker.net/media/content/users/15964/locker/top_hud2.png

    This means when the HUD reaches the edge of the layout and stops, there is about 1000 pxls which can't be seen, but are still there....

    At the moment I'm busy trying to add this space the HUD covers with a border which will act like the edge of the layout but it's time consuming, to say the least!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Aguamoose

    Set Unbounded Scrolling to Yes, and instead of using the Scroll To behaviour, you use your own clamped values.

    System: Scroll to position (clamp(Player.X, BorderThicknessHorz, LayoutWidth - BorderThicknessHorz), clamp(Player.Y, BorderThicknessVert, LayoutHeight - BorderThicknessVert))

    You might need to play around with the values a bit, so as not to show outside the layout or cut off the player sprite, but this should give you the general idea

  • Oh ok, now I understand your issue.

    Try this - remove ScrollTo behavior, set Unbounded scrolling=Yes in layout properties and add this event:

    System -> Every tick

    ........System-Set scroll X to clamp(Player.x, OriginalWindowWidth/2-50, LayoutWidth-OriginalWindowWidth/2+50)

    ........System-Set scroll Y to clamp(Player.y, OriginalWindowHeight/2-30, LayoutHeight-OriginalWindowHeight/2+30)

    Where 30 and 50 is the thickness of your HUD borders.

    This will allow to scroll the layout 30 and 50 pixels beyond the layout size.

    OddConfection You beat me by just 1 minute!

  • dop2000 OddConfection thank you both so much, you've just saved me days of work ^_^

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