Keep web app from turning when phone turns

Get help using Construct 2

Post » Sun Dec 09, 2012 5:43 pm

Im looking for a way to lock the web page from turnining when the phone turns sideways. I'm assuming that I need to edit the index.html file. I published my game in scale mode and it is actually is sized 640x480 and views fine on any phone I've tested on. Basically I want it locked in position. I don't want it resizing on double touches either, which it does on some phones even if the "screen rotation" is turned off. Is there something more I can do in Construct2? Or is it a matter of editing the index.html file?

Any help is appreciated.

Also: you can view it here at http://www.neoprofessor.com/3013/M
Image
B
71
S
22
G
2
Posts: 671
Reputation: 8,522

Post » Sun Dec 09, 2012 11:12 pm

html on these devices have no way to lock the screen. It's not possible at this time. It sucks, but that's the way of it. I discovered this when writing my own webapp in code. So C2 won't give you a solution to this.

However, that doesn't mean you might not be able to adjust. I haven't tried this in C2, but this is what you can try to do.

on device orientation change to portrait
rotate your the game layouts so that it's now back to portrait. however this has the catch that players will still see the rotation and the pop back when you change your layout angle.

alternativly which is what I did
on device orientation change to portrait
put up a different screen and pause the app. Then inform the player that please rotate back to landscape.

However, cacoonjs and appmobi may provide locking options. As I haven't done this bridging as of yet I have no idea if it's possible. but I think it would be.



B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Mon Dec 10, 2012 5:37 am

Jayderyu is right, appmobi and CocoonJS can both do this. I recommend Cocoon though as appMobi has some game-breaking bugs you are likely to run into.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Post » Mon Dec 10, 2012 10:55 am

Unfortunately there are no mobile browsers that support orientation lock at all yet - it's just a quirk of HTML5 right now, but it is being fixed (I think an orientation lock standard is being worked on). Workarounds are either just to use letterbox scale, so it just scales and shows black bars down the sides when you rotate, or pause the game and ask to set the orientation back if it's turned the wrong way.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Tue Dec 11, 2012 4:11 am

Thanks for the responses everyone. Much appreciated!
Image
B
71
S
22
G
2
Posts: 671
Reputation: 8,522


Return to How do I....?

Who is online

Users browsing this forum: makkancs, Marxally and 30 guests