Doch noch eine kleinere Änderungen
This commit is contained in:
parent
bc007c2274
commit
5783976829
1 changed files with 7 additions and 2 deletions
9
game.py
9
game.py
|
|
@ -123,8 +123,6 @@ class Game:
|
|||
pygame.draw.rect(self.display, "grey", wall)
|
||||
|
||||
|
||||
velocity = self.speed * self.dt
|
||||
|
||||
|
||||
# Smooth Movement
|
||||
keys = pygame.key.get_pressed()
|
||||
|
|
@ -134,6 +132,9 @@ class Game:
|
|||
keys[pygame.K_s] - keys[pygame.K_w]
|
||||
)
|
||||
|
||||
if direction.length_squared() > 0:
|
||||
direction = direction.normalize()
|
||||
|
||||
movement = direction * self.speed * self.dt
|
||||
|
||||
self.player_pos += movement
|
||||
|
|
@ -164,6 +165,10 @@ class Game:
|
|||
self.player_pos.y = self.player_rect.centery
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
self.player_pos[1] = max(self.player_pos[1], self.player_height/2)
|
||||
|
||||
self.player_pos[1] = min(self.player_pos[1], SCREEN_HEIGHT/2-self.player_height/2)
|
||||
|
|
|
|||
Loading…
Reference in a new issue