How do I lock mobile orientation?

Get help using Construct 2

Post » Sat Dec 05, 2015 6:31 pm

In Configuration Settings, I've set orientation to Landscape. However, this does nothing and rotating my device still rotates (and distorts) my game. Additionally, I have no Browser object. How can I lock mobile orientation?
B
7
Posts: 24
Reputation: 320

Post » Sat Dec 05, 2015 6:55 pm

You should have the browser object..
It's an official plugin..
Are you sure you don't already have it in your project?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 05, 2015 7:04 pm

I'm not sure if this changes anything, but I'm using the Personal License from Steam. Even though I have not placed the browser object, it is listed as an Object Type in this menu:
Image

I also tried to set the orientation + fullscreen in the Intel XDK build menu, but that didn't work either. How can I use the browser object to lock mobile orientation?

Quick edit: LittleStain, is there any way I can thank you for your help? Can I give you reputation points? Sorry, I'm very new to Construct 2- but you're very helpful! :)
B
7
Posts: 24
Reputation: 320

Post » Sat Dec 05, 2015 7:08 pm

So the browser object is already in your project, as I expected..
Like I said in your other thread, the browser object has an action " lock orientation"
You can use this action to lock the orientation..

From the browser manual

Lock orientation
Unlock orientation


Lock the display of the game to a portrait or landscape mode only, if the current platform supports this. This only has effect on mobile devices. The game may have to already be displaying in fullscreen (using the Request fullscreen action) before the orientation can be locked. Unlocking the orientation restores whatever behavior was set before locking, such as automatically changing orientation depending on the way the device is being held.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 05, 2015 7:14 pm

PixelLab wrote:LittleStain, is there any way I can thank you for your help? Can I give you reputation points? Sorry, I'm very new to Construct 2- but you're very helpful! :)


Nope, the forum doesn't support that..
I'm here because I like helping people..
A great way of thanking me (and everyone else that gives advice here), is making a good game..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 05, 2015 9:55 pm

Thank you so much for all your help! I'm happy to say that I can no longer rotate the display while in-game, and it looks like this:
Image

However, on exiting the game and re-opening, the orientation has moved to this:
Image

Why is this the case, when I'm telling it to scroll to the center of the layout on layout start?
Image

For reference, here is a picture of the whole layout:
Image
(if the image appears cut off, scroll out on the browser)

How can I fix this odd scrolling? By the way, LittleStain, if you're on Steam I'd be happy to gift you a ~$10 thing for all your help :) Just send a request to steamcommunity.com/id/__mors__

EDIT: found a fix, and I set it to scroll to the layout center every tick. If this is a bad plan for some reason, please let me know a better way :)
B
7
Posts: 24
Reputation: 320

Post » Tue Jan 05, 2016 12:44 am

@PixelLab Every tick might be a bad idea. The same "Browser" object has an event called "On Resumed"
This is basically used when you pressed the HOME button or went out of the game and returned back.

You can set your scroll to layout center in this event.

Similarly there is an event called "On Suspended". Trigger when you go out of the game by pressing "HOME". Both events are good for Pausing and resuming the game :)

BTW, what platform are you testing teh Orientation on?
Create your own Isometric Runner Game using C2:

Image

Check out my game "Last of the Survivors":
Play Store
App Store
B
52
S
8
G
1
Posts: 399
Reputation: 4,153


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests