tRy ThIs
parent
faa5b33e00
commit
013fde7c08
|
@ -28,8 +28,8 @@ public class Litecraft extends Game{
|
|||
public Litecraft() {
|
||||
Constants.movementSpeed = 0.00005f;
|
||||
Constants.turnSpeed = 0.00002f;
|
||||
Constants.gravity = -0.000000000005f;
|
||||
Constants.jumpPower = 0.000005f;
|
||||
Constants.gravity = -0.0000000005f;
|
||||
Constants.jumpPower = 0.00005f;
|
||||
|
||||
Window.create(1200, 800, "LiteCraft", 60);
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class Litecraft extends Game{
|
|||
Camera camera = new Camera(new Vector3f(0,0.1f,0), player);
|
||||
ginger3D = new Ginger();
|
||||
|
||||
data = new GameData(player, camera, 20);
|
||||
data = new GameData(player, camera, 40);
|
||||
data.handleGuis = false;
|
||||
ginger3D.setup(new MasterRenderer(camera), this);
|
||||
|
||||
|
|
|
@ -31,14 +31,14 @@ public class Player extends RenderObject{
|
|||
float dz = (float) (distance * Math.cos(Math.toRadians(super.getRotY())));
|
||||
super.increasePosition(dx, 0, dz);
|
||||
if(t != null) {
|
||||
super.increasePosition(0, (float) (upwardsSpeed * (Window.getTime())), 0);
|
||||
terrainHeight = t.getHeightOfTerrain(super.getPosition().x, super.getPosition().z);
|
||||
upwardsSpeed += Constants.gravity * Window.getTime();
|
||||
if(super.getPosition().y < terrainHeight) {
|
||||
isInAir = false;
|
||||
upwardsSpeed = 0;
|
||||
super.getPosition().y = terrainHeight;
|
||||
}
|
||||
}
|
||||
super.increasePosition(0, (float) (upwardsSpeed * (Window.getTime())), 0);
|
||||
upwardsSpeed += Constants.gravity * Window.getTime();
|
||||
if(super.getPosition().y < terrainHeight) {
|
||||
isInAir = false;
|
||||
upwardsSpeed = 0;
|
||||
super.getPosition().y = terrainHeight;
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,20 +55,20 @@ public class Player extends RenderObject{
|
|||
if(Window.isKeyDown(GLFW.GLFW_KEY_W)) {
|
||||
this.currentSpeed = Constants.movementSpeed;
|
||||
}
|
||||
else if(Window.isKeyDown(GLFW.GLFW_KEY_S)) {
|
||||
else if(Window.isKeyPressed(GLFW.GLFW_KEY_S)) {
|
||||
this.currentSpeed = -Constants.movementSpeed;
|
||||
}else {
|
||||
this.currentSpeed = 0;
|
||||
}
|
||||
|
||||
if(Window.isKeyDown(GLFW.GLFW_KEY_A)) {
|
||||
if(Window.isKeyPressed(GLFW.GLFW_KEY_A)) {
|
||||
this.currentTurn = Constants.turnSpeed;
|
||||
|
||||
}
|
||||
else if(Window.isKeyDown(GLFW.GLFW_KEY_D)) {
|
||||
this.currentTurn = -Constants.turnSpeed;
|
||||
}
|
||||
if(Window.isKeyReleased(68) || Window.isKeyReleased(65)){
|
||||
if(!Window.isKeyDown(68) || !Window.isKeyDown(65)){
|
||||
this.currentTurn = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue