Accelerometer for 8-Directional movement

0 favourites
  • 7 posts
From the Asset Store
Easy jumping mechanic with 8 direction behaviour. 9 EVENTS
  • Is it possible?

    Something similar to movement of the ball in labyrinth games.

    Except the player isnt on the floor so i wouldnt want the phone to be held flat at zero degrees

    My game is at landscape orientation & I'm aware I can use Beta orientation and simulate left & right movements but I'd like for my game to have 8 or at least 4 directional movement

    Sorry I'm unfamiliar with this

  • You can use alfa and gamma as well.

    If you dont want the phone to be held falt at zero degrees you could just change where your "zero" is. e.g. have your zero at gamma = 80 or something.

    A lot of the games today which use accelerometer actually set the gamma zero point when the game starts, and then sets the zero point to the current gamma position.

  • Okay I'll give that a try, I was using the platform behavior to move the player but I can only simulate left & right. Maybe by replacing that behavior with physics for movement will work.

    Thanks

  • cvp I was testing the gamma out, do you know how I'd set the gamma's zero point to the current position at the start of the layout ? I noticed touch can't be used as an action.

  • Yeah, look at Kyatric example.

    a quick comment. If you want the "zero" point to be somewhere else. you can just add or deduct a number each time you compare the touch.gamma/beta/alfa value

    something like(if 40 was your new zero point):

    system --> compare two values --> touch.beta >= 40

    --- whatever you want to do when the device is tilted forward

    system --> compare two values --> touch.beta< 40

    --- whatever you want to do when the device is tilted backward

    note... it might be the other way around(backward/forward), cant remember the beta numbers. But I hope you get the idea :-)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'll take a look at Kyatric's example & also I'll try comparing the two values. The beta was working its just the zero point became an issue since I had to tilt the phone far to go in both directions. I appreciate the help

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