From c8fc3278b17ebf48dc8756c034001ca6ac6ffbc1 Mon Sep 17 00:00:00 2001 From: CobaltXII Date: Sun, 30 Dec 2018 15:20:38 -0500 Subject: [PATCH] Implemented friction and movement --- src/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 72a4b03..61587b0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -298,6 +298,17 @@ int main(int argc, char** argv) { player_vy += acceleration; } + + // Update the player's velocity and position. + + player_vx *= friction; + player_vy *= friction; + player_vz *= friction; + + player_x += player_vx; + player_y += player_vy; + player_z += player_vz; + // Clear the OpenGL context to the default Minceraft sky color. glClearColor(186.0f / 255.0f, 214.0f / 255.0f, 254.0f / 255.0f, 1.0f);