diff --git a/main.py b/main.py index 6f962e33..2651b5ac 100644 --- a/main.py +++ b/main.py @@ -546,6 +546,10 @@ def get_motion_vector(self): dy = 0.0 dx = math.cos(x_angle) dz = math.sin(x_angle) + elif self.flying and not self.dy == 0: + dx = 0.0 + dy = self.dy + dz = 0.0 else: dy = 0.0 dx = 0.0 @@ -721,7 +725,9 @@ def on_key_press(self, symbol, modifiers): elif symbol == key.D: self.strafe[1] += 1 elif symbol == key.SPACE: - if self.dy == 0: + if self.flying: + self.dy = 0.5 * JUMP_SPEED + elif self.dy == 0: self.dy = JUMP_SPEED elif symbol == key.ESCAPE: self.set_exclusive_mouse(False) @@ -751,6 +757,8 @@ def on_key_release(self, symbol, modifiers): self.strafe[1] += 1 elif symbol == key.D: self.strafe[1] -= 1 + elif symbol == key.SPACE: + self.dy = 0 def on_resize(self, width, height): """ Called when the window is resized to a new `width` and `height`.