Compare commits

..

4 Commits

Author SHA1 Message Date
Yadciel
322f808f38 Merge remote-tracking branch 'LF08/Fahrzeug' into Fahrzeug 2023-03-31 12:38:17 +02:00
Yadciel
89f820f1f7 Fahrzeug 2023-03-31 12:37:20 +02:00
76694f3407 Merge pull request 'Erz,Tank,Ziel' (#1) from Lf8 into main
Reviewed-on: http://192.168.2.198:3000/Yadciel/LF08/pulls/1
2023-03-31 12:15:08 +02:00
Faruk Acar
315e3764d1 Erz,Tank,Ziel 2023-03-31 12:13:48 +02:00
3 changed files with 62 additions and 0 deletions

45
background.py Normal file
View File

@ -0,0 +1,45 @@
import pygame
class Erz(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.image = pygame.image.load("Erzmine.jpg").convert_alpha()
self.rect = self.image.get_rect()
self.rect = 330, 20
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):
super().__init__()
self.image = pygame.image.load("Tank.png").convert_alpha()
self.rect = self.image.get_rect()
self.rect = 30, 220
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):
super().__init__()
self.image = pygame.image.load("Ziel.jpg").convert_alpha()
self.rect = self.image.get_rect()
self.rect = 330, 520
def draw(self, win):
groesse = pygame.transform.scale(self.image, (100, 100))
win.blit(groesse, self.rect)

14
game.py
View File

@ -1,11 +1,16 @@
import pygame
import fahrzeug
import background
import player
import sys
def start():
pygame.init()
win = pygame.display.set_mode((800, 800))
player1 = fahrzeug.Fahrzeug(0, 0)
Erzmine = background.Erz()
Tanken = background.Tank()
Ziele = background.Ziel()
# Farben
white = (255, 255, 255)
@ -38,6 +43,15 @@ def start():
if tilemap[x][y] == 1:
pygame.draw.rect(win, blue, (x * tile_size, y * tile_size, tile_size, tile_size))
Erzmine.update()
Erzmine.draw(win)
Tanken.update()
Tanken.draw(win)
Ziele.update()
Ziele.draw(win)
player1.update()
player1.draw(win)

View File

@ -5,6 +5,8 @@ import game
pygame.init()
win = pygame.display.set_mode((500, 500))
clock = pygame.time.Clock()
# Farben
white = (255, 255, 255)
black = (0, 0, 0)
@ -48,4 +50,5 @@ while True:
pygame.draw.rect(win, gray, quit_button)
win.blit(quit_text, (quit_button.x + 10, quit_button.y + 10))
clock.tick(60)
pygame.display.update()