main
Maksims Stogovs 2023-12-22 23:46:39 +02:00
parent 1d4c22a77e
commit 9a5e46539c
2 changed files with 5 additions and 2 deletions

View File

@ -40,8 +40,11 @@ enemies = pygame.sprite.Group()
all_sprites = pygame.sprite.Group()
all_sprites.add(player)
bg = pygame.image.load("sprites/background.png").convert()
# Main loop
while running:
screen.blit(bg, (0,0))
# Look at every event in the queue
for event in pygame.event.get():
# Did the user hit a key?
@ -61,8 +64,6 @@ while running:
enemies.add(new_enemy)
all_sprites.add(new_enemy)
# Fill the background with white
screen.fill((255, 255, 255))
# Get all the keys currently pressed
pressed_keys = pygame.key.get_pressed()
@ -77,6 +78,8 @@ while running:
for entity in all_sprites:
screen.blit(entity.surf, entity.rect)
# Check if any enemies have collided with the player
if pygame.sprite.spritecollideany(player, enemies):
# If so, then remove the player and stop the loop

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 KiB