0 Favourites

Detect device orientation (0, 90, 180, -90)

  • Hi,

    I'm making an accelerometer HTML5 game with Construct 2.

    I can easily get Touch.Beta and Touch.gamma values, but i can't lock screen orientation so I can use these values onyl when the orientation is equal to 0.

    Is it possible to detect device orientation (0, 90, 180, -90) like in javascript with window.orientation ? <img src="smileys/smiley5.gif" border="0" align="middle" />

    I need the browser orientation.

    <img src="http://image.noelshack.com/fichiers/2013/51/1387551392-browserorientation.jpg" border="0" />

  • Couldn't you get the orientation from the Alpha, Beta and Gamma values?

    And adjust your events accordingly?

  • From the manual:

    Compare orientation

    Compare the device's current orientation, if the device has a supported inclinometer. Alpha is the compass direction in degrees. Beta is the device front-to-back tilt in degrees (i.e. tilting forwards away from you if holding in front of you). A positive value indicates front tilt and a negative value indicates back tilt. Gamma is the device left-to-right tilt in degrees (i.e. twisting if holding in front of you). A positive value indicates right tilt and a negative value indicates left tilt.

  • I want to know if it's possible to detect browser orientation.

  • If you used the search option in the Manual you would have found this entry in the browser object:

    is portrait/landscape

    Determine if the current display is portrait (height is greater than width) or landscape (width is greater than height). This is performed by making a simple check on the window size of the browser, so also returns accordingly on a desktop browser depending on its dimensions.

  • Dude, i'm searching in the manual since one day...

    I don't want know if the display is portrait or landscape, i want know if the display is portrait, reverse portrait, landscape or reverse landscape

    I can't post a link so take that link and remove the * before .jpg

    image.noelshack.com/fichiers/2013/51/1387551392-browserorientation*.jpg

  • First of all, I don't like being called dude.

    Second of all, if someone is trying to help you, it would be a good idea to at least pretend to be thankfull.

    I hope you find out what the answer to your question is from someone, who doesn't mind rudeness..

  • <img src="smileys/smiley22.gif" border="0" align="middle" /> It's not at all an insult, and if you take it like that, sorry. You are insinuating that I don't search in the manual, this is false, I'm just telling you.

  • somonflex

    Are you planning to use an exporter or you're making an online browser game?

  • Knifegrinder

    I'm making an online browser game. I mustn't use an exporter.

  • I think (but I never played deeply with it so i'm only supposing) that checking if alpha, beta and gamma values are positive or negative in combination with the browser object "is portrait/landscape" condition should give you enough information to retrieve the window orientation.

    Unfortunately I'm at work so I can't experiment with it.

  • Thx Knifegrinder, I'll look this.

    If you find a solution, you can share it!

  • somonflex

    Knifegrinder just gave just about the same explanation I was suggesting, so there was no need to Dude! me. Dude, might not have been meant insulting, it's a clear form of disrespect (at least in the way you typed it) I'm sure my response was a bit over the top, but that was more aimed at the last 10 people I helped without getting thanks, than to you personally.

    I was under the impression you could have figured out yourself that using the alpha beta and gamma values combined with browser orientation would work and in fact your second question was just about browser orientation, but obviously you were asking for something you already new the answer to.

    Like before, I hope you figure it out..

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • so whats the answer to this? without having to use Rex's tilt plugin to detect orientation?

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