I got some issues. I'm using LibGDX.
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) ?
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?
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 ?
Thank You !
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;
}
if (isAlive)block around your code that changes the velocity. - Tenfour04