58 lines
1.8 KiB
Python
58 lines
1.8 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.scaled_image = pygame.transform.scale(self.image, (self.image.get_width() / 2, self.image.get_height() / 2))
|
|
self.rect = self.scaled_image.get_rect(center=(x, y))
|
|
self.rect.centerx = x
|
|
self.rect.centery = y
|
|
self.debug = False
|
|
|
|
def draw(self, win):
|
|
if self.debug:
|
|
pygame.draw.rect(win, (255, 0, 0), self.rect)
|
|
win.blit(self.scaled_image, 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() / 20, self.image.get_height() / 20))
|
|
self.rect = self.scaled_image.get_rect(center=(x, y))
|
|
self.rect.centerx = x
|
|
self.rect.centery = y
|
|
self.debug = False
|
|
|
|
def draw(self, win):
|
|
if self.debug:
|
|
pygame.draw.rect(win, (255, 0, 0), self.rect)
|
|
win.blit(self.scaled_image, 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.scaled_image = pygame.transform.scale(self.image, (self.image.get_width() / 3, self.image.get_height() / 3))
|
|
self.rect = self.scaled_image.get_rect(center=(x, y))
|
|
self.rect.centerx = x
|
|
self.rect.centery = y
|
|
self.debug = False
|
|
|
|
def draw(self, win):
|
|
if self.debug:
|
|
pygame.draw.rect(win, (255, 0, 0), self.rect)
|
|
win.blit(self.scaled_image, self.rect)
|
|
|
|
|