# Accelerometer for 8-Directional movement

Get help using Construct 2

### » Mon Jul 15, 2013 2:52 am

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
B
6
S
2
Posts: 151
Reputation: 1,366

### » Mon Jul 15, 2013 8:29 am

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.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

### » Mon Jul 15, 2013 8:51 pm

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
B
6
S
2
Posts: 151
Reputation: 1,366

### » Thu Jul 18, 2013 5:24 am

@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.
B
6
S
2
Posts: 151
Reputation: 1,366

### » Thu Jul 18, 2013 9:30 am

seen Kyatric example here?

B
38
S
17
G
3
Posts: 879
Reputation: 6,923

### » Thu Jul 18, 2013 1:13 pm

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 :-)
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

### » Thu Jul 18, 2013 10:26 pm

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
B
6
S
2
Posts: 151
Reputation: 1,366