Skip to content

Commit

Permalink
issue #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikaosolu Amaechi committed Jun 20, 2023
1 parent d6888a6 commit 6ca5a52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define CRAFT_KEY_CHAT 't'
#define CRAFT_KEY_COMMAND '/'
#define CRAFT_KEY_SIGN '`'

#define CRAFT_KEY_RUN GLFW_KEY_LEFT_CONTROL
// advanced parameters
#define CREATE_CHUNK_RADIUS 10
#define RENDER_CHUNK_RADIUS 10
Expand Down
6 changes: 6 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2413,12 +2413,17 @@ void handle_movement(double dt) {
State *s = &g->players->state;
int sz = 0;
int sx = 0;
int isRunning = 0;
if (!g->typing) {
float m = dt * 1.0;
g->ortho = glfwGetKey(g->window, CRAFT_KEY_ORTHO) ? 64 : 0;
g->fov = glfwGetKey(g->window, CRAFT_KEY_ZOOM) ? 15 : 65;
if (glfwGetKey(g->window, CRAFT_KEY_FORWARD)) sz--;
if (glfwGetKey(g->window, CRAFT_KEY_BACKWARD)) sz++;
if (glfwGetKey(g->window, CRAFT_KEY_FORWARD)) {
if(glfwGetKey(g->window, CRAFT_KEY_RUN)) isRunning = 1;
sz--;
}
if (glfwGetKey(g->window, CRAFT_KEY_LEFT)) sx--;
if (glfwGetKey(g->window, CRAFT_KEY_RIGHT)) sx++;
if (glfwGetKey(g->window, GLFW_KEY_LEFT)) s->rx -= m;
Expand All @@ -2439,6 +2444,7 @@ void handle_movement(double dt) {
}
}
float speed = g->flying ? 20 : 5;
if(isRunning) speed*=4;
int estimate = roundf(sqrtf(
powf(vx * speed, 2) +
powf(vy * speed + ABS(dy) * 2, 2) +
Expand Down

0 comments on commit 6ca5a52

Please sign in to comment.