2023-03-31 11:54:10 +02:00
|
|
|
import pygame
|
|
|
|
|
2023-04-14 12:31:54 +02:00
|
|
|
# Farbe Weiß
|
|
|
|
WHITE = (255, 255, 255)
|
2023-03-31 11:54:10 +02:00
|
|
|
|
2023-04-25 08:30:43 +02:00
|
|
|
|
2023-03-31 11:54:10 +02:00
|
|
|
class Erz(pygame.sprite.Sprite):
|
2023-04-25 08:30:43 +02:00
|
|
|
def __init__(self, x, y):
|
2023-03-31 11:54:10 +02:00
|
|
|
super().__init__()
|
2023-04-22 12:45:53 +02:00
|
|
|
self.image = pygame.image.load("resources/Erzmine.png").convert_alpha()
|
2023-04-28 10:30:51 +02:00
|
|
|
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))
|
2023-04-25 09:07:44 +02:00
|
|
|
self.rect.centerx = x
|
|
|
|
self.rect.centery = y
|
2023-05-08 22:11:59 +02:00
|
|
|
self.debug = False
|
2023-03-31 11:54:10 +02:00
|
|
|
|
|
|
|
def draw(self, win):
|
2023-05-08 22:11:59 +02:00
|
|
|
if self.debug:
|
|
|
|
pygame.draw.rect(win, (255, 0, 0), self.rect)
|
2023-04-28 10:30:51 +02:00
|
|
|
win.blit(self.scaled_image, self.rect)
|
|
|
|
|
2023-03-31 11:54:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Tank(pygame.sprite.Sprite):
|
2023-04-25 08:30:43 +02:00
|
|
|
def __init__(self, x, y):
|
2023-03-31 11:54:10 +02:00
|
|
|
super().__init__()
|
2023-04-25 08:30:43 +02:00
|
|
|
self.image = pygame.image.load("resources/Tank.jpg").convert_alpha()
|
2023-04-28 10:30:51 +02:00
|
|
|
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))
|
2023-04-25 09:07:44 +02:00
|
|
|
self.rect.centerx = x
|
|
|
|
self.rect.centery = y
|
2023-05-08 22:11:59 +02:00
|
|
|
self.debug = False
|
2023-03-31 11:54:10 +02:00
|
|
|
|
|
|
|
def draw(self, win):
|
2023-05-08 22:11:59 +02:00
|
|
|
if self.debug:
|
|
|
|
pygame.draw.rect(win, (255, 0, 0), self.rect)
|
2023-04-28 10:30:51 +02:00
|
|
|
win.blit(self.scaled_image, self.rect)
|
|
|
|
|
|
|
|
|
2023-03-31 11:54:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Ziel(pygame.sprite.Sprite):
|
2023-04-25 08:30:43 +02:00
|
|
|
def __init__(self, x, y):
|
2023-03-31 11:54:10 +02:00
|
|
|
super().__init__()
|
2023-04-25 08:30:43 +02:00
|
|
|
self.image = pygame.image.load("resources/Ziel.jpg").convert_alpha()
|
2023-04-28 10:30:51 +02:00
|
|
|
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))
|
2023-04-25 09:07:44 +02:00
|
|
|
self.rect.centerx = x
|
|
|
|
self.rect.centery = y
|
2023-05-08 22:11:59 +02:00
|
|
|
self.debug = False
|
2023-03-31 11:54:10 +02:00
|
|
|
|
|
|
|
def draw(self, win):
|
2023-05-08 22:11:59 +02:00
|
|
|
if self.debug:
|
|
|
|
pygame.draw.rect(win, (255, 0, 0), self.rect)
|
2023-04-28 10:30:51 +02:00
|
|
|
win.blit(self.scaled_image, self.rect)
|
|
|
|
|
|
|
|
|