2026-04-23 16:33:28 +02:00

25 lines
727 B
Python

import pygame
from game_object import GameObject
class Wall(GameObject):
def __init__(self, window_size, width, color):
top_wall = pygame.rect.Rect(0, 0, window_size[0], width)
left_wall = pygame.rect.Rect(0, 0, width, window_size[1])
bottom_wall = pygame.rect.Rect(0, window_size[1]-width, window_size[0], width)
right_wall = pygame.rect.Rect(window_size[0]-width, 0, width, window_size[1])
self.__walls = [top_wall, left_wall, bottom_wall, right_wall]
self.__color = color
def draw(self, surface):
for wall in self.__walls:
pygame.draw.rect(surface, self.__color, wall)
def get_bounding_boxes(self):
return self.__walls