How do I implement tilt controls consistently across mobile

  • Ok. I have read through the forums, checked the touch object in the manual, I have downloaded capx to see what other people have done and have experimented for lots of days (I did print out the values returned) but I still can not find a way to implement Tilt controls consistently on different mobile devices.

    The target:

    I am making a game where I want to make a penguin move left when the player tilts his phone left and right when he tilts it right in portrait mode. I used the following methods.

    -The first one used the Touch.Gamma expression.

    -The second one used the Touch.Beta expression.

    -The third used the Touch.AccelerationXWithG expression.

    The problem:

    Each method works on some mobiles but not on others!! I tested on the following mobiles and have noted what controls work and what not:

    Samsung Galaxy Wonder (android 4.2.2): Acceleration Yes, Gamma Yes, Beta No.

    Samsung Galaxy Tab 2 10.1 (android 4.2.2): Acceleration No, Gamma No, Beta Yes.

    ----Also, if the player has deactivated AutoRotation on their phone, Touch.AccelerationXWithG returns 0 which, as you can understand, breaks the controls.

    Samsung Galaxy Fame (android 4.1.2): Acceleration No, Gamma Yes (inverted), Beta No.

    Sony Experia Acro S (android 4.1.2): Acceleration Yes, Gamma Yes, Beta No.

    Request:

    Can anyone help me figure this out? Other people have made games with tilt controls that work on multiple devices, so I am probably not doing something correctly (or I am plain dumb). I am willing to give a consulting fee of $10 to the person that can help me solve this issue. Below I include a link to the capx that I used to test things and an apk, so you can see the code I used and test it on your phones.

    https://dl.dropboxusercontent.com/u/1342998/OrientationTest_Multi.capx - capx

    https://dl.dropboxusercontent.com/u/1342998/OrientationTest.android.apk - apk for phone iXDK export

  • Anyone? Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Did you ever get an answer because i'm stuck too!

  • Nope, I never got a reply from anyone and I also posted on Reddit-no luck there either. I have abandoned the project now and will NEVER touch tilt controls in Construct 2 again.

  • I'm having same issue.

    Tilt works perfect when I run on an ipad (using gamma / beta) . But same tilt program does not work on Galaxy.

    Anyone have a guess as to why?

  • I wrote about this in my blog for Firefox OS using HTML5. You can read it here if you want to see the underlying native HTML5 code. http://firefoxosgaming.blogspot.com/2013/12/device-orientation-game-programming.html.

    The technical term is device orientation.

    Unfortunately, the sad answer is:

    1. Not all device manufacturers support this.

    2. Not all browsers support this.

    I wanted to go further with this but there isn't enough support yet. Sorry!

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