def __init__(self, x, y, blocks, orientation, images, screen):
"""
:param x: Integer, the x-position of the wall.
:param y: Integer, the y-position of the wall.
:param blocks: Integer, the number of times to replicate the wall.
:param orientation: String, either 'v' or 'h' for vertical or horizontal.
:param images: Tuple, containing either a single or three
pygame.Surfaces to build the platform.
:param screen: pygame.Surface, the screen to draw the wall onto.
"""
self.screen = screen
if len(images) == 3:
image = buildParts(blocks, orientation, images)
elif len(images) == 1:
image = replicate(blocks, orientation, images[0])
else:
raise ValueError("A wall must have one or three images only!")
self.render = RenderComponent(self)
self.render.add("idle", image)
self.render.state = "idle"
self.rect = pg.Rect(x, y, 0, 0)
评论列表
文章目录