DSZI_Survival/src/game/TerrainTile.py

19 lines
597 B
Python

from pathlib import Path
import pygame
# TODO: Relative coords
class TerrainTile(pygame.sprite.Sprite):
def __init__(self, x, y, texture, tileSize, cost):
super().__init__()
terrainTexturesPath = Path("./data/images/terrain").resolve()
self.image = pygame.image.load(str(terrainTexturesPath / texture)).convert()
self.image = pygame.transform.scale(self.image, (tileSize, tileSize))
self.rect = self.image.get_rect()
self.x = x
self.y = y
self.rect.x = x * tileSize
self.rect.y = y * tileSize
self.cost = cost