Accelerometer movement

FanStudioUKFanStudioUK Member Posts: 459
edited November -1 in Working with GS (Mac)
Hi guys,

In my game I'm using this method to make my character move through the scene with the accelerometer:

Constrain: Self.Motion.Linear.Velocity.X - 500*(-game.Accelerometer.Y) (My game is in Landscape mode)

I have one problem, if I play the game, landscape mode with my home button on my right hand side everything runs ok, BUT if I flip the screen and I have the home button on my left hand side my player's movement is backwards!

Is there any way to find which way the iPhone is held so everything will run ok both sides?

Thank you :)

Comments

  • ShpintShpint Member Posts: 404
    Auto Rotate perhaps?
  • FanStudioUKFanStudioUK Member Posts: 459
    Autorotate is checked, both Landscape left & right...so it doesn't seem to help with my problem...
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    when you flip the device the X and Y axis are still the same. So you need to account for the flip in your coding. In the expression ediot you can access the device orientation. you will need to put your acceleromeer behaviors in a rule that says

    rule - when game.screen.deviceOrientation is landscape left
    accelerometer rules
    OTHERWISE
    accelerometer rules backwords
  • FanStudioUKFanStudioUK Member Posts: 459
    Thanks scitunes, I will give it a shot ;)
Sign In or Register to comment.