LF08/object.py
2023-04-25 09:07:44 +02:00

45 lines
1.4 KiB
Python

import pygame
# Farbe Weiß
WHITE = (255, 255, 255)
class Erz(pygame.sprite.Sprite):
def __init__(self, x, y):
super().__init__()
self.image = pygame.image.load("resources/Erzmine.png").convert_alpha()
self.rect = self.image.get_rect()
self.rect.centerx = x
self.rect.centery = y
def draw(self, win):
groesse = pygame.transform.scale(self.image, (100, 100))
win.blit(groesse, self.rect)
class Tank(pygame.sprite.Sprite):
def __init__(self, x, y):
super().__init__()
self.image = pygame.image.load("resources/Tank.jpg").convert_alpha()
self.scaled_image = pygame.transform.scale(self.image, (self.image.get_width() / 100, self.image.get_height() / 100))
self.rect = self.scaled_image.get_rect()
self.rect.centerx = x
self.rect.centery = y
def draw(self, win):
groesse = pygame.transform.scale(self.image, (100, 100))
win.blit(groesse, self.rect)
class Ziel(pygame.sprite.Sprite):
def __init__(self, x, y):
super().__init__()
self.image = pygame.image.load("resources/Ziel.jpg").convert_alpha()
self.rect = self.image.get_rect()
self.rect.centerx = x
self.rect.centery = y
def draw(self, win):
groesse = pygame.transform.scale(self.image, (100, 100))
win.blit(groesse, self.rect)