How do I cut off edges on Unbounded Layout?

0 favourites
  • 11 posts
  • So if I set unbouded layout I end up with white margins at the edge of the screen. I don't know exactly how to fix this

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use Scale Inner or Scale Outer layout "Fullscreen in browser" setting.

  • Use Scale Inner or Scale Outer layout "Fullscreen in browser" setting.

    Doesnt work. My screen size is 320x200.

    Here's Bounded:

    Here's Unbounded Scrolling:

    I want to avoid those edges happening.

  • That's what unbounded scrolling will do, it scrolls past the layout edges so it shows what's outside the layout. Since there's nothing, you simply see your background layer color, which is white from your screenshot. Simply add backgrounds outside the layout or change the color of your layer to your liking so it's not white.

  • That's what unbounded scrolling will do, it scrolls past the layout edges so it shows what's outside the layout. Since there's nothing, you simply see your background layer color, which is white from your screenshot. Simply add backgrounds outside the layout or change the color of your layer to your liking so it's not white.

    I've seen a couple of unbounded scrolling games and they restrict the edges.

  • The whole point of unbounded scrolling is to ignore the layout edge restriction. What exactly are you trying to accomplish ? Do you want unbounded vertical scrolling but bounded horizontal one ?

  • The whole point of unbounded scrolling is to ignore the layout edge restriction. What exactly are you trying to accomplish ? Do you want unbounded vertical scrolling but bounded horizontal one ?

    To be honest I was just testing out stuff. I guess there's no reason for unbounded scrolling for my game, is just a simple platformer, just wanted to avoid having to set layout size for each level..

  • I guess it could work if you scroll with events instead of the scrollTo behavior.

    Every tick : 
        Scroll to position : X: max(Sprite.X, OriginalWindowWidth/2)
                             Y: Sprite.Y[/code:2k8xdub7]
    
    With the layout set to unbounded scrolling, this would effectively make it so the scrolling is only bounded by the left edge.
  • I guess it could work if you scroll with events instead of the scrollTo behavior.

    > Every tick : 
        Scroll to position : X: max(Sprite.X, OriginalWindowWidth/2)
                             Y: Sprite.Y[/code:1w0iwne0]
    
    With the layout set to unbounded scrolling, this would effectively make it so the scrolling is only bounded by the left edge.
    

    Will try it out but in your experience would you recommend bound scrolling for my needs?

  • I guess in the end it doesn't make much of a difference, apart from the fact that you could ignore adjusting each of your layout's size, as you mentioned.

  • Your background for the layer is black yes? I assumed that you used an appropriate background color.

    If you want to avoid that altogether, than you need to use unbounded scrolling and then manually limit your scroll at the edge of your background image. Something like:

    compare:

    backgroundImage.X - backgroundImage.Width/2 (assuming your hotspot is in the center) >= ViewportLeft("mainUI")

    and

    backgroundImage.X + backgroundImage.Width/2 (assuming your hotspot is in the center) <= ViewportRight("mainUI")

    and

    backgroundImage.Y - backgroundImage.Height/2 (assuming your hotspot is in the center) >= ViewportTop("mainUI")

    and

    backgroundImage.Y + backgroundImage.Height/2 (assuming your hotspot is in the center) <= ViewportBottom("mainUI")

    and if you want to keep your critter in the center of the screen, then you have to use a suitable layer background color and just suffer the sidebars... you can't have your nice scrolling and eat it too.

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