diff --git a/Erzmine.jpg b/Erzmine.jpg deleted file mode 100644 index 2474e8b..0000000 Binary files a/Erzmine.jpg and /dev/null differ diff --git a/Erzmine.png b/Erzmine.png new file mode 100644 index 0000000..9257226 Binary files /dev/null and b/Erzmine.png differ diff --git a/Tank.png b/Tank.png index 3881a1e..6c09b74 100644 Binary files a/Tank.png and b/Tank.png differ diff --git a/Ziel.jpg b/Ziel.jpg deleted file mode 100644 index 4ed9e44..0000000 Binary files a/Ziel.jpg and /dev/null differ diff --git a/Ziel.png b/Ziel.png new file mode 100644 index 0000000..a3ef3b9 Binary files /dev/null and b/Ziel.png differ diff --git a/background.py b/background.py index 8afd507..8c3839c 100644 --- a/background.py +++ b/background.py @@ -1,10 +1,12 @@ import pygame +# Farbe Weiß +WHITE = (255, 255, 255) class Erz(pygame.sprite.Sprite): def __init__(self): super().__init__() - self.image = pygame.image.load("Erzmine.jpg").convert_alpha() + self.image = pygame.image.load("Erzmine.png").convert_alpha() self.rect = self.image.get_rect() self.rect = 330, 20 @@ -34,7 +36,7 @@ class Ziel(pygame.sprite.Sprite): def __init__(self): super().__init__() - self.image = pygame.image.load("Ziel.jpg").convert_alpha() + self.image = pygame.image.load("Ziel.png").convert_alpha() self.rect = self.image.get_rect() self.rect = 330, 520 diff --git a/fahrzeug.py b/fahrzeug.py index 1159ab5..a86e34c 100644 --- a/fahrzeug.py +++ b/fahrzeug.py @@ -13,6 +13,7 @@ class Fahrzeug(pygame.sprite.Sprite): self.dest_y = y self.direction = pygame.math.Vector2(0, -1) self.angle = 0 + self.Tank = 100 def draw(self, win): rotated_image = pygame.transform.rotate(self.image, self.angle) @@ -32,5 +33,8 @@ class Fahrzeug(pygame.sprite.Sprite): if self.rect.centery > self.dest_y: self.rect.centery -= self.speed + if self.rect.centerx != self.dest_x and self.rect.centery != self.dest_y: + self.Tank -= 0.1 + def dest(self, pos): self.dest_x, self.dest_y = pos diff --git a/game.py b/game.py index 121d6f5..5e5f293 100644 --- a/game.py +++ b/game.py @@ -42,6 +42,10 @@ def start(): if tilemap[x][y] == 1: pygame.draw.rect(win, blue, (x * tile_size, y * tile_size, tile_size, tile_size)) + font = pygame.font.SysFont(None, 24) + img = font.render('Tank: '+str(round(player1.Tank,2)), True, white) + win.blit(img, (20, 20)) + Erzmine.update() Erzmine.draw(win)