[ADD] made camera follow the character with lerp

This commit is contained in:
Nathalie Seen
2021-06-08 10:55:48 +02:00
parent 86383aace5
commit edbbfb136a
6 changed files with 35 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ namespace entities
glm::vec3 main_character::move(GLFWwindow* window)
{
float movement_speed = -1.0f;
float up_down_speed = -0.4f;
float up_down_speed = -0.2f;
float side_speed = 0;
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
@@ -47,6 +47,11 @@ namespace entities
up_down_speed -= UP_SPEED;
}
IncreasePosition(glm::vec3(side_speed, up_down_speed, movement_speed));
if (position.x > 190) position.x = 190;
else if (position.x < -190) position.x = -190;
if (position.y > 350) position.y = 350;
else if (position.y < -40) position.y = -40;
MoveCollisionBox();
return glm::vec3(side_speed, up_down_speed, movement_speed );
}
}