2020-04-06 12:30:21 +02:00
|
|
|
from pathlib import Path
|
|
|
|
|
2020-04-03 19:36:13 +02:00
|
|
|
import pygame
|
|
|
|
|
|
|
|
|
|
|
|
class TerrainTile(pygame.sprite.Sprite):
|
2020-04-05 19:08:08 +02:00
|
|
|
def __init__(self, x, y, texture, tileSize):
|
2020-04-03 23:07:12 +02:00
|
|
|
super().__init__()
|
2020-04-06 12:30:21 +02:00
|
|
|
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))
|
2020-04-03 19:36:13 +02:00
|
|
|
self.rect = self.image.get_rect()
|
2020-04-05 19:08:08 +02:00
|
|
|
self.x = x
|
|
|
|
self.y = y
|
|
|
|
self.rect.x = x * tileSize
|
|
|
|
self.rect.y = y * tileSize
|