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

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    It's best to test how the accelerometer performs by displaying the accelerometer attributes in some actors on the scene and tip the device and see the actual numbers. Then you will know what < or > numbers to use. .01 is just a starting point.
  • gawakamygawakamy Member Posts: 109
    @FryingBaconStudios Thanks. What are the maximun and minimun number in accelerometer? 0.01 is not minimum?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Do the test and you will see.
Sign In or Register to comment.