-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwall.py
More file actions
24 lines (19 loc) · 711 Bytes
/
wall.py
File metadata and controls
24 lines (19 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pygame
class Wall(pygame.sprite.Sprite):
def __init__(self, screen, health = 4):
super(Wall, self).__init__()
self.screen = screen
self.screen_rect = screen.get_rect()
self.image = pygame.image.load(f"icons/wall_{health}.png")
self.rect = self.image.get_rect()
self.rect.centerx = 100
self.health = health
def print(self):
self.screen.blit(self.image, self.rect)
def update(self):
self.health -= 1
if self.health >= 0:
self.image = pygame.image.load(f"icons/wall_{self.health}.png")
self.screen.blit(self.image, self.rect)
else:
self.kill()