DSZI_Survival/src/game/TerrainTile.py

17 lines
542 B
Python
Raw Normal View History

from pathlib import Path
import pygame
class TerrainTile(pygame.sprite.Sprite):
def __init__(self, x, y, texture, tileSize):
2020-04-03 23:07:12 +02:00
super().__init__()
terrainTexturesPath = Path("./data/images/terrain").resolve()
self.image = pygame.image.load(str(terrainTexturesPath / texture)).convert()
2020-04-03 23:07:12 +02:00
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