-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrick.py
More file actions
33 lines (28 loc) · 744 Bytes
/
brick.py
File metadata and controls
33 lines (28 loc) · 744 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
25
26
27
28
29
30
31
32
33
"""
Author Paul Brace March 2025
PacMan game developed using arcade
Brick class used for maze walls
"""
import arcade
import constants
from constants import WINDOW_HEIGHT
class Brick(arcade.Sprite):
brick_image = [
arcade.load_texture('images/brick0.png'),
arcade.load_texture('images/brick1.png'),
arcade.load_texture('images/brick2.png'),
arcade.load_texture('images/brick3.png'),
arcade.load_texture('images/penOpening.png')
]
# position of opening image
BRICK = 1
OPENING = 4
def __init__(self, element, x, y):
image = Brick.brick_image[element]
x = x * 20 + 20
y = WINDOW_HEIGHT - (y * 20 + 40)
super().__init__(image, 1, x, y)
if element < 4:
self.type = Brick.BRICK
else:
self.type = Brick.OPENING