Entities now load with relative coords

This commit is contained in:
Marcin Kostrzewski 2020-05-14 12:11:57 +02:00
parent 065111dee9
commit 95972ac969

View File

@ -54,9 +54,7 @@ class Map:
if entity["isPickupable"]: if entity["isPickupable"]:
actualEntities.append(Pickupable(entity["name"] + ".png", actualEntities.append(Pickupable(entity["name"] + ".png",
self.tileSize, self.tileSize,
# TODO: change to relative coords (entity["position"]["x"], entity["position"]["y"]),
(entity["position"]["x"] * self.tileSize,
entity["position"]["y"] * self.tileSize),
Statistics(entity["effect"]["hp"], Statistics(entity["effect"]["hp"],
entity["effect"]["hunger"], entity["effect"]["hunger"],
entity["effect"]["thirst"], entity["effect"]["thirst"],
@ -65,9 +63,7 @@ class Map:
elif "effect" in entity: elif "effect" in entity:
actualEntities.append(Interactable(entity["name"] + ".png", actualEntities.append(Interactable(entity["name"] + ".png",
self.tileSize, self.tileSize,
# TODO: Change to relative coords (entity["position"]["x"], entity["position"]["y"]),
(entity["position"]["x"] * self.tileSize,
entity["position"]["y"] * self.tileSize),
Statistics(entity["effect"]["hp"], Statistics(entity["effect"]["hp"],
entity["effect"]["hunger"], entity["effect"]["hunger"],
entity["effect"]["thirst"], entity["effect"]["thirst"],
@ -76,9 +72,7 @@ class Map:
else: else:
actualEntities.append(Entity(entity["name"] + ".png", actualEntities.append(Entity(entity["name"] + ".png",
self.tileSize, self.tileSize,
# TODO: Change to relative coords (entity["position"]["x"], entity["position"]["y"])))
(entity["position"]["x"] * self.tileSize,
entity["position"]["y"] * self.tileSize)))
except KeyError: except KeyError:
print("Failed to load entity " + entity) print("Failed to load entity " + entity)
return actualEntities return actualEntities