does somebody can create gravity? if yes please told me how to do it
public class Player extends SmoothMover {
public void act() { }
}
public class Player extends SmoothMover {
// vY stands for velocity in Y direction
private double vY = 0;
...
public void act() {
// getExactX/Y are methods from SmoothMover that return the location as double
setLocation(getExactX(), getExactY() + vY);
}
...
private static final double GRAVITY = 0.1;
public void act() {
vY += GRAVITY;
...