Skip to main content
Descriptive title, tags
Link
DMGregory
  • 140.8k
  • 23
  • 257
  • 401

Accelerometer problems Controlling a fighter jet's altitude using device accelerometer

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Fixed spelling mistakes, fixed the code display and the list display. Fixed the tags.
Source Link
Vaillancourt
  • 16.4k
  • 17
  • 56
  • 61
  1. When I hit an object, my Fighter is supposed to fall to the Ground but because of the Accelerometer, I can still move it up and down even though it died. The Scroller on the x-Axis though stops.  
    Question: (FIXED) How can I make the Accelerometer stop, after I've been hit, and make the Fighter accelerate to the ground (in absence of the accelerometer, all by itself)?

  2. When I move the Fighter up and down, the transition from "moving up" to "moving down" isn't smooth. It seems like it lags.  
    Question: How can I Increase the Sensitivity of my Accelerometer?

  3. Also, Whenwhen I tilt the Phonephone further, the velocity staystays the same.  
    Question: How can iI increase the velocity, in relation to the tilt degree  ?

The Codes are Belowcode is below:

Accelerometer Code:

       float accelY = Gdx.input.getAccelerometerY();

 

      if (Gdx.input.getAccelerometerY() < 5){
         velocity.y = -40;
      }
 

      if (Gdx.input.getAccelerometerY() > 5){
         velocity.y = 40;
      }

When Fighter hits an Object and dies:

              public void die() {
      isAlive = false;
      velocity.y = 0;
      acceleration.y = 460;
   }
  1. When I hit an object, my Fighter is supposed to fall to the Ground but because of the Accelerometer, I can still move it up and down even though it died. The Scroller on the x-Axis though stops. Question: (FIXED) How can I make the Accelerometer stop, after I've been hit, and make the Fighter accelerate to the ground (in absence of the accelerometer, all by itself)?

  2. When I move the Fighter up and down, the transition from "moving up" to "moving down" isn't smooth. It seems like it lags. Question: How can I Increase the Sensitivity of my Accelerometer?

  3. Also, When I tilt the Phone further, the velocity stay the same. Question: How can i increase the velocity, in relation to the tilt degree  ?

The Codes are Below:

Accelerometer Code:

       float accelY = Gdx.input.getAccelerometerY();

 

      if (Gdx.input.getAccelerometerY() < 5){
         velocity.y = -40;
      }
 

      if (Gdx.input.getAccelerometerY() > 5){
         velocity.y = 40;
      }

When Fighter hits an Object and dies:

              public void die() {
      isAlive = false;
      velocity.y = 0;
      acceleration.y = 460;
   }
  1. When I hit an object, my Fighter is supposed to fall to the Ground but because of the Accelerometer, I can still move it up and down even though it died. The Scroller on the x-Axis though stops.  
    Question: (FIXED) How can I make the Accelerometer stop, after I've been hit, and make the Fighter accelerate to the ground (in absence of the accelerometer, all by itself)?

  2. When I move the Fighter up and down, the transition from "moving up" to "moving down" isn't smooth. It seems like it lags.  
    Question: How can I Increase the Sensitivity of my Accelerometer?

  3. Also, when I tilt the phone further, the velocity stays the same.  
    Question: How can I increase the velocity, in relation to the tilt degree?

The code is below:

Accelerometer Code:

float accelY = Gdx.input.getAccelerometerY();

if (Gdx.input.getAccelerometerY() < 5){
   velocity.y = -40;
}

if (Gdx.input.getAccelerometerY() > 5){
   velocity.y = 40;
}

When Fighter hits an Object and dies:

public void die() {
    isAlive = false;
    velocity.y = 0;
    acceleration.y = 460;
}
  1. When I hit an object, my Fighter is supposed to fall to the Ground. BUT, but because of the Accelerometer, iI can still move it up and down eventhougheven though it died. The Scroller on the x-Axis though stops. Question: (FIXED) How can iI make the Accelerometer stop, after IveI've been hit, and make the Fighter accelerate to the ground (in absence of the accelerometer, all by itself)  ?

  2. When I move the Fighter up and down, the transition from "moving up" to "moving down" isntisn't smooth. It seems like it laggslags. Question: How can I Increase the Sensitivity of my Accelerometer?

  3. Also, When I tilt the Phone further, the velocity stay the same. Question: How can i increase the velocity, in relation to the tilt degree ?

The Codes are Below:

Accelerometer Code:

       float accelY = Gdx.input.getAccelerometerY();



      if (Gdx.input.getAccelerometerY() < 5){
         velocity.y = -40;
      }


      if (Gdx.input.getAccelerometerY() > 5){
         velocity.y = 40;
      }

When Fighter hits an Object and dies:

              public void die() {
      isAlive = false;
      velocity.y = 0;
      acceleration.y = 460;
   }
  1. When I hit an object, my Fighter is supposed to fall to the Ground. BUT, because of the Accelerometer, i can still move it up and down eventhough it died. The Scroller on the x-Axis though stops. Question: (FIXED) How can i make the Accelerometer stop, after Ive been hit, and make the Fighter accelerate to the ground (in absence of the accelerometer, all by itself)  ?

  2. When I move the Fighter up and down, the transition from "moving up" to "moving down" isnt smooth. It seems like it laggs. Question: How can I Increase the Sensitivity of my Accelerometer?

  3. Also, When I tilt the Phone further, the velocity stay the same. Question: How can i increase the velocity, in relation to the tilt degree ?

The Codes are Below:

Accelerometer Code:

       float accelY = Gdx.input.getAccelerometerY();



      if (Gdx.input.getAccelerometerY() < 5){
         velocity.y = -40;
      }


      if (Gdx.input.getAccelerometerY() > 5){
         velocity.y = 40;
      }

When Fighter hits an Object and dies:

              public void die() {
      isAlive = false;
      velocity.y = 0;
      acceleration.y = 460;
   }
  1. When I hit an object, my Fighter is supposed to fall to the Ground but because of the Accelerometer, I can still move it up and down even though it died. The Scroller on the x-Axis though stops. Question: (FIXED) How can I make the Accelerometer stop, after I've been hit, and make the Fighter accelerate to the ground (in absence of the accelerometer, all by itself)?

  2. When I move the Fighter up and down, the transition from "moving up" to "moving down" isn't smooth. It seems like it lags. Question: How can I Increase the Sensitivity of my Accelerometer?

  3. Also, When I tilt the Phone further, the velocity stay the same. Question: How can i increase the velocity, in relation to the tilt degree ?

The Codes are Below:

Accelerometer Code:

       float accelY = Gdx.input.getAccelerometerY();



      if (Gdx.input.getAccelerometerY() < 5){
         velocity.y = -40;
      }


      if (Gdx.input.getAccelerometerY() > 5){
         velocity.y = 40;
      }

When Fighter hits an Object and dies:

              public void die() {
      isAlive = false;
      velocity.y = 0;
      acceleration.y = 460;
   }
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Tweeted twitter.com/StackGameDev/status/781925611786866688
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 57 characters in body; edited title
Source Link
Kromster
  • 10.7k
  • 4
  • 55
  • 67
Loading
Source Link
Loading