How do I lock mobile orientation?

  • 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?

  • You should have the browser object..

    It's an official plugin..

    Are you sure you don't already have it in your project?

  • 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:

    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!

  • 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.

  • 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..

  • 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:

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

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

    For reference, here is a picture of the whole layout:

    (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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)