Skip to content

Commit

Permalink
Modify camera controls to first person flythrough
Browse files Browse the repository at this point in the history
  • Loading branch information
jmickle66666666 committed Dec 12, 2018
1 parent 97700b3 commit 07bc555
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions DelvEdit/src/com/interrupt/dungeoneer/editor/EditorFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public boolean isWestFloor() {
float camZ = 4.5f;

float rotX = 0;
float rotY = 20;
float rotY = 20f;
double rota = 0;
double rotya = 0;

Expand Down Expand Up @@ -2174,27 +2174,31 @@ else if(turnDown) {
rotY += rotya;
rotya *= 0.8;

float xm = 0;
float zm = 0;
if(editorInput.isKeyPressed(Keys.A))
xm = -0.8f;
if(editorInput.isKeyPressed(Keys.D))
xm = 0.8f;
float xm = 0f;
float zm = 0f;

if(editorInput.isKeyPressed(Keys.W))
zm = -0.8f;
if(editorInput.isKeyPressed(Keys.S))
zm = 0.8f;
if(editorInput.isKeyPressed(Keys.A)) {
xm = -1f;
}
if(editorInput.isKeyPressed(Keys.D)) {
xm = 1f;
}

if(editorInput.isKeyPressed(Keys.Q)) {
camZ -= 0.1f;
if(editorInput.isKeyPressed(Keys.W)) {
zm = -1f;
}
if(editorInput.isKeyPressed(Keys.E)) {
camZ += 0.1f;
if(editorInput.isKeyPressed(Keys.S)) {
zm = 1f;
}

if (editorInput.isKeyPressed(Keys.SHIFT_LEFT)) {
xm *= 2.0f;
zm *= 2.0f;
}

camX += (xm * Math.cos(rotX) + zm * Math.sin(rotX)) * walkSpeed;
camY += (zm * Math.cos(rotX) - xm * Math.sin(rotX)) * walkSpeed;
camY += (zm * Math.cos(rotX) - xm * Math.sin(rotX)) * walkSpeed * Math.cos(rotY);
camZ += (zm * Math.sin(rotY)) * walkSpeed;

if(player != null) {
player.rot = rotX;
Expand Down

0 comments on commit 07bc555

Please sign in to comment.