school-horror-game/scripts/wall.py

38 lines
No EOL
1.1 KiB
Python

import pygame
from scripts.constants import *
class Wall:
def __init__(self, game, x: float, y: float, width: float, height: float):
self.game = game
self.x = x
self.y = y
self.width = width
self.height = height
self.rect = pygame.Rect(x, y, width, height)
for i in range(self.width):
if i % 64 == 0:
end_ergebnis_width = i
for i in range(self.height):
if i % 64 == 0:
end_ergebnis_height = i
self.length: dict = {
"width": end_ergebnis_width+TILE_SIZE,
"height": end_ergebnis_height+TILE_SIZE,
}
def update(self):
pass
def render(self, surface: pygame.Surface):
for x in range(self.length["width"]):
for y in range(self.length["height"]):
if y % TILE_SIZE == 0 and x % TILE_SIZE == 0:
surface.blit(self.game.assets["wall"], pygame.Rect(self.x+x, self.y+y, self.width, self.height))
def get_rect(self) -> pygame.Rect:
return self.rect