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

Get help using Construct 2

Post » Fri Dec 20, 2013 2:28 pm

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 ?

I need the browser orientation.

somonflex2013-12-20 15:35:30
B
5
Posts: 14
Reputation: 355

Post » Fri Dec 20, 2013 2:41 pm

Couldn't you get the orientation from the Alpha, Beta and Gamma values?
And adjust your events accordingly?

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 » Fri Dec 20, 2013 2:45 pm

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 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 » Fri Dec 20, 2013 3:01 pm

I want to know if it's possible to detect browser orientation.
B
5
Posts: 14
Reputation: 355

Post » Fri Dec 20, 2013 3:07 pm

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.LittleStain2013-12-20 15:07:22
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 » Fri Dec 20, 2013 3:12 pm

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
B
5
Posts: 14
Reputation: 355

Post » Fri Dec 20, 2013 3:20 pm

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..
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 » Fri Dec 20, 2013 3:31 pm

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.
B
5
Posts: 14
Reputation: 355

Post » Fri Dec 20, 2013 4:31 pm

@somonflex
Are you planning to use an exporter or you're making an online browser game?
B
11
S
3
Posts: 224
Reputation: 2,028

Post » Fri Dec 20, 2013 4:34 pm

@Knifegrinder
I'm making an online browser game. I mustn't use an exporter.
B
5
Posts: 14
Reputation: 355

Next

Return to How do I....?

Who is online

Users browsing this forum: jkmalau, terence951, vegapomme27 and 9 guests