fire once for each layout change?

Get help using Construct 2

Post » Thu Aug 30, 2012 4:51 pm

Hi,

I have two layouts, one for landscape and one for portrait (for mobile).

They both have the same event sheet attached.

However, when the player switches from one to the other, the layouts objects are destroyed, and I lose game state (as I was storing the game state in the objects parameters.

I need to restore game state on layout switch.

I tried adding an "on start of layout" event, but this fires if you resize the same layout, so not useful in this case.

I can see a few ideas:
1) store the layout state (portrait or landsape) in globals. I try and avoid globals for state where possible as they are difficult to manage in complex conditions.

2) possibly detach the single event sheet from both layouts, and attatch separate event sheets that do something only once on switching to that layout, then include the main event sheet. However, I dont know what that event might be?

3) other cunning strategy?

Thanks!




B
15
S
5
G
2
Posts: 357
Reputation: 3,691

Post » Thu Aug 30, 2012 4:57 pm

I think you could do this without different layouts.
Have you tried the fullscreen modes? They allow for the viewport to scale to meet the browsers size

also there is a system action to set the canvas sizekeepee2012-08-30 17:03:25
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Thu Aug 30, 2012 5:31 pm

thanks for the reply.

Unfortunately, the letterbox scaling is not appropriate for mobile, as black bars are not acceptable to the customer and it makes the buttons too small, especailly in landscape.

What is a canvas? I cant find it in the manual.

I am strugling to understand the difference between window size, viewport size, actuall browser window size, layout size, layer scaling and canvas - I belive its a missing page in the manual.

Any tips appreciated.
B
15
S
5
G
2
Posts: 357
Reputation: 3,691


Return to How do I....?

Who is online

Users browsing this forum: suicidenutella, Vallar and 0 guests