Skip to content

Commit dd00194

Browse files
committed
key R to reset the score
1 parent d41ffc5 commit dd00194

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
Move the spaceship to land on the planet.
44

55
## Control
6-
- WASD: moves the camera
6+
- WASD: Moves the camera.
77
- Brackets (`[`, `]`): Accelerates/Decelerates the spaceship.
8+
- R: Resets the score.
89

910
## HUD
1011
- Green lines: The orbit of the planet

main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Player player(glm::vec3(0.0f), 0.0f, 90.0f);
4242
float delta_time = 0.0f;
4343
float last_frame = 0.0f;
4444

45+
bool landed = false;
46+
4547
//To bypass the stbi error (Should be included in only one translation unit)
4648
class DrawableModel : public Drawable {
4749
public:
@@ -152,7 +154,6 @@ int main() {
152154

153155
// render loop
154156
// -----------
155-
bool landed = false;
156157
while (!glfwWindowShouldClose(window)) {
157158
// per-frame time logic
158159
// --------------------
@@ -265,6 +266,9 @@ void process_input(GLFWwindow *window) {
265266
if (glfwGetKey(window, GLFW_KEY_RIGHT_BRACKET) == GLFW_PRESS)
266267
forward_offset += delta_time;
267268

269+
if (glfwGetKey(window, GLFW_KEY_R) == GLFW_PRESS)
270+
landed = false; //Reset
271+
268272
player.process_input(forward_offset, pitch_offset, yaw_offset);
269273
}
270274

0 commit comments

Comments
 (0)