Change layout size at runtime

Discussion and feedback on Construct 2

Post » Sat Jan 31, 2015 6:06 pm

I would love to do this, change layout size at runtime so it will match the level automatically generated. I do not want the screen to scroll beyond the automatic generated level size. It is apparent at right side and bottom side. As the level generation start at topleft corner.

It could be bound to a certain condition so it will just be executed at the very loading of layout?
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Sat Jan 31, 2015 6:12 pm

I'm not sure if this is possible, but you could enable unbounded scrolling and just clamp the scrollX ans scrolly according to the level layout?
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sun Feb 01, 2015 10:43 pm

I am after this too. Anyone know how to change the layout size during runtime so that I can have different layout sizes?
Cyberphaze

What we build can never be destroyed
B
136
S
18
G
6
Posts: 37
Reputation: 14,744

Post » Mon Feb 02, 2015 2:00 am

Sorry forgot to reply to my own thread.
I asked here in this forum because I would like to see it actually be added to C2.

Have anyone tried the unbounded scrolling + clamp?
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Mon Feb 02, 2015 3:59 am

Yep, do it all the time. Just enable unbounded scrolling and use 9-patches or something to define the layout.
Image
B
242
S
29
G
13
Posts: 1,787
Reputation: 18,685

Post » Mon Feb 02, 2015 4:05 am

@Somebody
Nevermind, read next reply. :)

(removed bla bla bla)
Last edited by helena on Mon Feb 02, 2015 4:32 am, edited 2 times in total.
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Mon Feb 02, 2015 4:28 am

shot.jpg

Here's how I did it. (I guessed the numbers and it is correct for the level I am working on)

For other people wanting to use this: substitute the "smoothplayercam" for your sprite that you want to "follow".
do not forget disable/delete "Scroll To" behavior.

I need to go back to bed, but tomorrow I will figure out how to make the numbers dynamic so it will reflect
for different level sizes.

This should be turned into a tutorial!

Thanks!
You do not have the required permissions to view the files attached to this post.
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Tue Feb 03, 2015 4:38 am

scroll.jpg


So there, now I made the numbers dynamic.

I wonder if you can help me verify that the level stays within its border (the chocolate border) and no white is seen nor it is too small.

Compare level 1 with T2.

http://www.funnybunny.se/game/

@Somebody - if you have time. :)

I hope this solution will work and not that it will eff up depending on which browser/system you use.
You do not have the required permissions to view the files attached to this post.
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Tue Feb 03, 2015 7:20 am

helena wrote:@Somebody - if you have time. :)

I hope this solution will work and not that it will eff up depending on which browser/system you use.

That cracked me up given all the cuteness in this project :D

Seems to work perfectly. It shouldn't be affected by browsers or anything, since the scrolling logic is entirely up to C2. As long as the numbers are correct it should be as well.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Tue Feb 03, 2015 3:41 pm

@Somebody
Awesome, thanks.

Ah the eff... I limited myself from fuck. ;) Cuteness mixed with profanity!
B
58
S
18
G
13
Posts: 447
Reputation: 10,735


Return to Construct 2 General

Who is online

Users browsing this forum: Colludium, jefftrier, unicornspitfire and 5 guests