Choose random width at beginning of layout?

Get help using Construct 2

Post » Wed Aug 13, 2014 3:54 pm

I am trying to create procedurally generated levels. To do this, I would need to be able to choose different layout widths at the start of the layout. Is this possible? I don't see it as an option in the available system events. Thanks, Morgan.
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Wed Aug 13, 2014 4:00 pm

Nevermind - it's choose canvas size.
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Thu Aug 14, 2014 3:55 am

Actually, "set canvas size" only changes the window size of the particular layout, I'm actually wanting to be able to set the layout width to a random value. Does anyone know how to do this?
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Thu Aug 14, 2014 4:01 am

You can't change layout size on runtime. Use unbounded scrolling instead.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343

Post » Thu Aug 14, 2014 4:17 am

@shinkan - thank you. I tried that but then the player's avatar goes off of the screen all together. That's too bad that the size of the layout can't be changed at runtime. Do you think that would be a good feature? It would help me easily create randomized levels.
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Thu Aug 14, 2014 4:23 am

Unbounded scrolling set to Yes lets you make you levels no matter how big or small they are. When you turn it on it will center viewport on XY: 0,0 coordinates, so you need to scroll it to your player avatar position.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343

Post » Thu Aug 14, 2014 4:28 am

I am using the scroll to behavior with the main character's avatar but it isn't centering on it. Any idea what the problem may be?
Image
B
20
S
4
Posts: 382
Reputation: 2,974

Post » Thu Aug 14, 2014 1:41 pm

Maybe you could use something like this.
https://www.scirra.com/tutorials/747/zone-based-camera-movement
And scale that area to the size of the actual map.
B
34
S
9
G
3
Posts: 517
Reputation: 5,226


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 51 guests