Added Labyrinth. /JL
This commit is contained in:
24
labyrinth.py
Normal file
24
labyrinth.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from actors.enums import Colors
|
||||
import pygame
|
||||
|
||||
class Labyrinth:
|
||||
def __init__(self, screen, width, height, wall_thickness=20):
|
||||
self.screen = screen
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.wall_thickness = wall_thickness
|
||||
|
||||
def draw(self):
|
||||
w = self.wall_thickness
|
||||
mid_x = self.width // 2
|
||||
mid_y = self.height // 2
|
||||
|
||||
pygame.draw.rect(self.screen, Colors.Blue, (0, 0, mid_x - 50, w))
|
||||
pygame.draw.rect(self.screen, Colors.Blue, (mid_x + 50, self.width - (mid_x + 50), w))
|
||||
pygame.draw.rect(self.screen, Colors.Blue, (0, self.height - w, mid_x - 50, w))
|
||||
pygame.draw.rect(self.screen, Colors.Blue, (mid_x + 50, self.height - w, self.width - (mid_x + 50), w))
|
||||
|
||||
pygame.draw.rect(self.screen, Colors.Blue, (0, 0, w, mid_y -50))
|
||||
pygame.draw.rect(self.screen, Colors.Blue, (0, mid_y + 50, w, self.height - (mid_y + 50)))
|
||||
pygame.draw.rect(self.screen, Colors.Blue, (self.width - w, 0, w, mid_y - 50))
|
||||
pygame.draw.rect(self.screen, Colors.Blue, (self.width - w, mid_y + 50, w, self.height - (mid_y + 50)))
|
Reference in New Issue
Block a user