code skelett

This commit is contained in:
Aron Petau 2025-10-11 15:03:20 +02:00
parent 7bc89c3432
commit ab1f1cdaea
3 changed files with 14 additions and 9224 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -6,13 +6,13 @@ import rasterio
pygame.init()
WIDTH, HEIGHT = 800, 600
WIDTH, HEIGHT = 1920, 1080
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Water Bottle Shooter")
WHITE = (255, 255, 255)
BLUE = (0, 150, 255)
PLAYER_COLOR = (0, 200, 0)
PLAYER_COLOR = (200, 200, 0)
WATER_COLOR = (0, 180, 255)
PLAYER_SIZE = 40
@ -20,6 +20,14 @@ PLAYER_SPEED = 5
WATER_SIZE = 10
WATER_SPEED = 10
PLAYER_IMAGE_PATH = "player.png" # Path to your player image
try:
PLAYER_IMAGE = pygame.image.load(PLAYER_IMAGE_PATH).convert_alpha()
PLAYER_IMAGE = pygame.transform.scale(PLAYER_IMAGE, (PLAYER_SIZE, PLAYER_SIZE))
except Exception as e:
print(f"Could not load player image: {e}")
PLAYER_IMAGE = None
clock = pygame.time.Clock()
# Load raster map as background
@ -78,7 +86,10 @@ class Player:
self.rect.topleft = (self.x, self.y)
def draw(self, win, offset_x, offset_y):
pygame.draw.rect(win, PLAYER_COLOR, (self.x - offset_x, self.y - offset_y, PLAYER_SIZE, PLAYER_SIZE))
if PLAYER_IMAGE:
win.blit(PLAYER_IMAGE, (self.x - offset_x, self.y - offset_y))
else:
pygame.draw.rect(win, PLAYER_COLOR, (self.x - offset_x, self.y - offset_y, PLAYER_SIZE, PLAYER_SIZE))
class WaterBottle: