From ce50622b8941a9b2033eaef36a313abe3bc00a58 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Thu, 14 May 2020 11:13:09 +0200 Subject: [PATCH] Removed removeSprite method --- src/game/Map.py | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/game/Map.py b/src/game/Map.py index 137a1f0..13c2215 100644 --- a/src/game/Map.py +++ b/src/game/Map.py @@ -10,6 +10,7 @@ from src.entities.Entity import Entity from src.entities.Pickupable import Pickupable from src.entities.Statistics import Statistics + # TODO: Map should determine entities' position class Map: def __init__(self, filename, screen): @@ -53,7 +54,9 @@ class Map: if entity["isPickupable"]: actualEntities.append(Pickupable(entity["name"] + ".png", self.tileSize, - (entity["position"]["x"] * self.tileSize, entity["position"]["y"] * self.tileSize), + # TODO: change to relative coords + (entity["position"]["x"] * self.tileSize, + entity["position"]["y"] * self.tileSize), Statistics(entity["effect"]["hp"], entity["effect"]["hunger"], entity["effect"]["thirst"], @@ -61,18 +64,21 @@ class Map: # Creates an interactable object elif "effect" in entity: actualEntities.append(Interactable(entity["name"] + ".png", - self.tileSize, - (entity["position"]["x"] * self.tileSize, - entity["position"]["y"] * self.tileSize), - Statistics(entity["effect"]["hp"], - entity["effect"]["hunger"], - entity["effect"]["thirst"], - entity["effect"]["stamina"]))) + self.tileSize, + # TODO: Change to relative coords + (entity["position"]["x"] * self.tileSize, + entity["position"]["y"] * self.tileSize), + Statistics(entity["effect"]["hp"], + entity["effect"]["hunger"], + entity["effect"]["thirst"], + entity["effect"]["stamina"]))) # Creates plain entity else: actualEntities.append(Entity(entity["name"] + ".png", - self.tileSize, - (entity["position"]["x"] * self.tileSize, entity["position"]["y"] * self.tileSize))) + self.tileSize, + # TODO: Change to relative coords + (entity["position"]["x"] * self.tileSize, + entity["position"]["y"] * self.tileSize))) except KeyError: print("Failed to load entity " + entity) return actualEntities @@ -120,7 +126,6 @@ class Map: result = tile return result - def getTileOnCoord(self, coord): result = None for tile in self.terrainTilesList: @@ -138,17 +143,6 @@ class Map: if not DONTADD: self.entities.append(entity) - # Usuwa entity lub teren z mapy - def removeSpriteFromMap(self, sprite): - if self.collidables.has(sprite): - self.collidables.remove(sprite) - if sprite in self.entities: - self.entities.remove(sprite) - if sprite in self.terrainTilesList: - self.terrainTilesList.remove(sprite) - # TODO: Suspicious? - self.screen.removeSprite(sprite) - # add object to map.collidables list to be collidable def collision(self, x, y): for b in self.collidables: