Loads tiles from file properly on all platforms
This commit is contained in:
parent
479c6eece7
commit
89cf106432
@ -1,14 +1,13 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pygame
|
||||
import os
|
||||
from os import path
|
||||
|
||||
|
||||
class TerrainTile(pygame.sprite.Sprite):
|
||||
def __init__(self, x, y, texture, tileSize):
|
||||
super().__init__()
|
||||
self.imagesFolder = path.dirname("../data/images/")
|
||||
self.terrainFolder = path.join(self.imagesFolder, 'terrain')
|
||||
self.image = pygame.image.load(os.path.join(self.terrainFolder, texture)).convert()
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user