Entities load using abs path
This commit is contained in:
parent
89cf106432
commit
8f65ce87e2
@ -24,12 +24,12 @@ class Entity(pygame.sprite.Sprite):
|
|||||||
texturesFolder = ""
|
texturesFolder = ""
|
||||||
textureFile = ""
|
textureFile = ""
|
||||||
try:
|
try:
|
||||||
texturesFolder = Path("../data/images/entities")
|
texturesFolder = Path("./data/images/entities")
|
||||||
textureFile = texturesFolder / textureName
|
textureFile = texturesFolder / textureName
|
||||||
except IOError:
|
except IOError:
|
||||||
print("Cannot load texture from " + texturesFolder + ". Exiting...")
|
print("Cannot load texture from " + texturesFolder + ". Exiting...")
|
||||||
exit(1)
|
exit(1)
|
||||||
image = pygame.image.load(str(textureFile)).convert_alpha()
|
image = pygame.image.load(str(textureFile.resolve())).convert_alpha()
|
||||||
image = pygame.transform.scale(image, (tileSize, tileSize))
|
image = pygame.transform.scale(image, (tileSize, tileSize))
|
||||||
rect = image.get_rect()
|
rect = image.get_rect()
|
||||||
return image, rect
|
return image, rect
|
||||||
|
Loading…
Reference in New Issue
Block a user