A question about Adroid

0 favourites
  • 5 posts
  • Hello,

    I have a question about android. With construct 2, i can make games, and save it as APK with Phonegap. The most android phones has the auto-rotate screen Technic. The auto-rotate screen Technic is used with some games, for example doodle jump. In that game, you steer to turn your phone to the left and the right.

    My question is, can I use that in construct 2.

    Thanks

    (Sorry for my bad English)

  • You can access accelerometer values from the touch object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you, i will read this page: scirra.com/manual/119/touch If i have questions, i post it here.

    <img src="smileys/smiley20.gif" border="0" align="middle" />

    EDIT: Do you have a accelerometer example for me, or do you know where i can find them?

  • Nobody has an example?

  • This snippet is valid for landscape mode in phonegap 1.7 and below (tested personally). Newer versions of phonegap return random accelerometer data breaking your game. Appmobi treats accelerometer data in a different way, CocoonJS does not seem to have accelerometer support yet (@ludei am I wrong?).

    global variable accangle = 0

    global variable deadzone = 15

    every tick -> set accangle to clamp(-int(touch.beta/10),-75,75)

    accangle > deadzone -> simulate platform pressing right

    accangle < -deadzone -> simulate platform pressing left

    Note: this is a really basic implementation. You may try to adjust at runtime the speed of your charachter and make it dependent from the accangle variable, but I have to warn you... it's a tricky task. The main risk is that your control system will become framerate dependent ruining your gameplay.

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