Set Layout.width/height?

Get help using Construct 2

Post » Wed Jul 03, 2013 10:15 am

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!
B
7
S
1
Posts: 11
Reputation: 574

Post » Wed Jul 03, 2013 1:00 pm

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.
B
12
S
5
G
2
Posts: 59
Reputation: 3,859

Post » Wed Jul 03, 2013 1:35 pm

Don't create a layout of maximum size. Just set 'unbounded scrolling' to 'yes' and implement the scrolling bounds yourself.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Wed Jul 03, 2013 6:48 pm

[QUOTE=Ashley] Don't create a layout of maximum size. Just set 'unbounded scrolling' to 'yes' and implement the scrolling bounds yourself.[/QUOTE]

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!
B
7
S
1
Posts: 11
Reputation: 574

Post » Wed Jul 03, 2013 7:12 pm

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.
B
7
S
1
Posts: 11
Reputation: 574


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, marcinkowski, Shenkai the ssj and 21 guests