Changing layout size at runtime.

Discussion and feedback on Construct 2

Post » Mon Aug 18, 2014 4:24 pm

@Ashley - I have been trying to set up a procedural random level generator and I noticed that the size of the layout can't be changed at runtime. This seems like it would be a good feature to me and would make a lot of randomization easier. It seems it would also be a good companion feature to "change canvas size." Thanks, Morgan.
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Mon Aug 18, 2014 4:34 pm

Have you tried "Wait 0.01 seconds" ?
B
49
S
15
G
6
Posts: 531
Reputation: 7,189

Post » Mon Aug 18, 2014 4:42 pm

Yes. It doesn't seem to change the options. You can set layout scale (which proportionally scales the entire layout) or set canvas size but you can't change the layout size.
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Mon Aug 18, 2014 4:47 pm

Use "Unbounded scrolling set to Yes" you will get infinite layout size.
ImageImageImageImage
B
157
S
64
G
41
Posts: 2,590
Reputation: 34,640

Post » Mon Aug 18, 2014 4:50 pm

I don't want an infinite size, I want it to be a range of very specific options and as we were discussing before, it seems the "scroll to" behavior doesn't work right with that chosen. Not sure why. Thanks.
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Mon Aug 18, 2014 4:59 pm

"Unbounded scrolling
By default the game window cannot scroll past the edges of the layout. Set this to Yes to allow unlimited scrolling in any direction, even past the edges of the layout."

Scroll to works perfectly fine with unbounded scrolling.
ImageImageImageImage
B
157
S
64
G
41
Posts: 2,590
Reputation: 34,640

Post » Tue Aug 19, 2014 2:43 am

Fair enough. Regardless, I am wanting to change the layout to very specific sizes, randomly.
Image
B
20
S
4
Posts: 382
Reputation: 2,964

Post » Tue Aug 19, 2014 2:47 am

unbounded + walls = any size you like.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Aug 19, 2014 12:05 pm

Just set unbounded scrolling and impose your own custom limits with events. 'Scroll To' definitely works with unbounded scrolling.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,250

Post » Tue Aug 19, 2014 12:34 pm

Make example object zone that is the size of your level or the area where you want the camera to move and use this.
Code: Select all
Scroll to X = lerp(scrollx,(clamp(hero.X,zone.X+(round(ViewportRight(0)-ViewportLeft(0))/2),zone.X+zone.Width-(160))),0.1*60*dt)
Scroll to Y = lerp(scrolly,(clamp(hero.Y,zone.Y+(round(ViewportBottom(0)-ViewportTop(0))/2),zone.Y+zone.Height-(120))),0.1*60*dt)
B
34
S
9
G
3
Posts: 517
Reputation: 5,206

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Brendan2007 and 6 guests