Need help with accelerometer and device orientation
My game I'm working on is designed to work in Portrait mode. It works in Portrait and Portrait upside down. I'm using accelerometer to control the actor's left and right movement. But here's my problem:
In 'Portrait Mode Upside Down': the game.Accelerometer.X works fine, but in just Portrait mode, it's backwards because the device is oriented different. So I need to tilt right to go left and tilt left to go right :P
So how does one set this up so no matter which of the two modes you're in, you can still tilt the iPad left to go left and tilt right to go right?
thanks a lot
shane
In 'Portrait Mode Upside Down': the game.Accelerometer.X works fine, but in just Portrait mode, it's backwards because the device is oriented different. So I need to tilt right to go left and tilt left to go right :P
So how does one set this up so no matter which of the two modes you're in, you can still tilt the iPad left to go left and tilt right to go right?
thanks a lot
shane
This discussion has been closed.
Comments
So for example, you can say...
If Accelerometer.Y < -0.1
If Screen.InterfaceOrientation is Landscape Left
Move left
Otherwise, Move right
If Accelerometer.Y > 0.1
If Screen.InterfaceOrientation is Landscape Left
Move right
Otherwise, Move left
I did something along those lines to get mine working just now.
For some reason, Up and Down seemed to switch across appropriately on it's own, so yay!
- Murray
If Accelerometer.Y < -0.1
___ If Screen.InterfaceOrientation is Landscape Left
______ Move left
___ Otherwise, Move right
If Accelerometer.Y > 0.1
___ If Screen.InterfaceOrientation is Landscape Left
______ Move right
___ Otherwise, Move left