Unnötige Instanzvariablen durch Konstante PLAYER_SIZE ersetzt.

This commit is contained in:
binaerverkehr 2026-09-26 13:22:28 +02:00
parent e3c70182fb
commit fd9018d0f1

View file

@ -2,6 +2,7 @@ import pygame
SCREEN_WIDTH = 1280 SCREEN_WIDTH = 1280
SCREEN_HEIGHT = 720 SCREEN_HEIGHT = 720
PLAYER_SIZE = 20
class Game: class Game:
@ -18,9 +19,7 @@ class Game:
self.dt: int = 0 self.dt: int = 0
# Spieler # Spieler
self.player_pos = pygame.Vector2(self.display.get_width() / 2, self.display.get_height() / 2) self.player_pos = pygame.Vector2(self.display.get_width() / 2, self.display.get_height() / 2)
self.player_width = 20 self.player = Player(self, self.player_pos, width=PLAYER_SIZE, height=PLAYER_SIZE)
self.player_height = 20
self.player = Player(self, self.player_pos, width=self.player_width, height=self.player_height)
# Items # Items
self.item_rect = pygame.Rect(70, 150, 10, 10) self.item_rect = pygame.Rect(70, 150, 10, 10)
self.flashlight = 0 self.flashlight = 0