How to solve this issue with the accelerometer function?

gawakamygawakamy Member Posts: 109
edited June 2012 in Working with GS (Mac)
Hi, GS dudes.
I am developing a game which use the accelerometer function. This game must be played with only accelerometer. There are characters, and they will move around tilting device. When I made it, the characters move only right upside and are stuck in the right upside corner. This is what I made as below.


= Accelerometer logic =
When Attribute. game.AccelerometerX > 0.01
Then Accelerometer Direction=180 Relative to scene, Acceleration=200

When Attribute. game.AccelerometerX < -0.01
Then Accelerometer Direction=0 Relative to scene, Acceleration=200

When Attribute. game.AccelerometerY > 0.01
Then Accelerometer Direction=90 Relative to scene, Acceleration=200

When Attribute. game.AccelerometerY < -0.01
Then Accelerometer Direction=270 Relative to scene, Acceleration=200


= Character logic =
Constrain Attribute self.Motion.Linear Velocity.X To abs(game.Accelerometer.X)*150
Constrain Attribute self.Motion.Linear Velocity.Y To abs(game.Accelerometer.Y)*150

Answers

Sign In or Register to comment.