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)?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?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;
}