school-horror-game/scripts/wall.py

36 lines
988 B
Python
Raw Normal View History

import pygame
from scripts.constants import *
class Wall:
def __init__(self, game, x: float, y: float, cols: int, rows: int):
self.game = game
self.x = x
self.y = y
self.cols = cols
self.rows = rows
2026-11-11 16:54:46 +00:00
self.rect = pygame.Rect(x, y, cols*TILE_SIZE, rows*TILE_SIZE)
self.drawed_rect = None
self.grid: list[list[pygame.Rect]] = []
2026-11-11 16:54:46 +00:00
for row in range(self.rows): # rows
current_row = []
for col in range(self.cols): # cols
2026-10-23 15:58:20 +00:00
current_row.append(pygame.Rect(self.x+col*TILE_SIZE, self.y+row*TILE_SIZE, col*TILE_SIZE, row*TILE_SIZE))
self.grid.append(current_row)
def update(self):
pass
2026-11-11 16:54:46 +00:00
def render(self, surface: pygame.Surface):
2026-10-23 15:45:28 +00:00
for row in self.grid:
for wall_rect in row:
2026-11-11 16:54:46 +00:00
surface.blit(self.game.assets["wall"], wall_rect)
2026-10-23 15:58:20 +00:00
def get_rect(self) -> pygame.Rect:
return self.rect