0

I am using libgdx framework for my android game and I need to detect if the user has shaken the mobile device, so how can I do that?

Kevin Bryan
  • 1,846
  • 2
  • 22
  • 45
  • Check this: http://stackoverflow.com/questions/5271448/how-to-detect-shake-event-with-android – Yasen Bagalev Mar 19 '16 at 17:41
  • You can get the accelerometer via Gdx.input.getAccelerometerX() or Y or Z – Yasen Bagalev Mar 19 '16 at 17:41
  • @Yasen Bagalev but I am using libgdx – Kevin Bryan Mar 20 '16 at 04:23
  • Ok, just check the first answer. You can copy the method, call it in the render method and replace lets say x = values[SensorManager.DATA_X]; with Gdx.input.getAccelerometerX(); The method of shake detection is the same on every platform/library. Just try to figure out how it works and use the accelerometer data – Yasen Bagalev Mar 20 '16 at 16:21

0 Answers0