Set Layout.width/height?

  • Hi everyone. Sorry if this was mentioned before, I couldn't find anything on what I'm looking for. I'm making a procgenned game that can generate levels of various sizes, and I can't find how to set the layout's X without altering its Y size.

    I want to first set a layout size according to how many "screens" the level's length should be (multiples of the game's resolution, so I can take advantage of the game's scrolling) before generating the level, but I can only find a function to set the layout's SCALE, not just X or Y.

    Could you please tell me how to set the layout's X value to a variable while ingame? Is that possible? Thanks!

  • I don't believe you can alter the Layout size in real time. It would be best to create a Layout of maximum size in the editor and limit how far you can scroll.

  • Don't create a layout of maximum size. Just set 'unbounded scrolling' to 'yes' and implement the scrolling bounds yourself.

  • Don't create a layout of maximum size. Just set 'unbounded scrolling' to 'yes' and implement the scrolling bounds yourself.

    Oh! So, I could preload all the level offscreen and pass the layout over it with unbounded scrolling? That would be ideal. Gonna try it out.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tried it, works like a charm. Anyone interested in levels of variable length, don't bother with layouts. Just spawn everything off-layout, turn unbounded scrolling on and then scroll over them.

    Thanks for the tip Ashley, I had heard about unbounded scrolling, but I wasn't sure it would help me, but you just saved me a lot of time.

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