Removed removeSprite method
This commit is contained in:
parent
57b95e10df
commit
ce50622b89
@ -10,6 +10,7 @@ from src.entities.Entity import Entity
|
|||||||
from src.entities.Pickupable import Pickupable
|
from src.entities.Pickupable import Pickupable
|
||||||
from src.entities.Statistics import Statistics
|
from src.entities.Statistics import Statistics
|
||||||
|
|
||||||
|
|
||||||
# TODO: Map should determine entities' position
|
# TODO: Map should determine entities' position
|
||||||
class Map:
|
class Map:
|
||||||
def __init__(self, filename, screen):
|
def __init__(self, filename, screen):
|
||||||
@ -53,7 +54,9 @@ class Map:
|
|||||||
if entity["isPickupable"]:
|
if entity["isPickupable"]:
|
||||||
actualEntities.append(Pickupable(entity["name"] + ".png",
|
actualEntities.append(Pickupable(entity["name"] + ".png",
|
||||||
self.tileSize,
|
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"],
|
Statistics(entity["effect"]["hp"],
|
||||||
entity["effect"]["hunger"],
|
entity["effect"]["hunger"],
|
||||||
entity["effect"]["thirst"],
|
entity["effect"]["thirst"],
|
||||||
@ -62,6 +65,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"] * self.tileSize,
|
(entity["position"]["x"] * self.tileSize,
|
||||||
entity["position"]["y"] * self.tileSize),
|
entity["position"]["y"] * self.tileSize),
|
||||||
Statistics(entity["effect"]["hp"],
|
Statistics(entity["effect"]["hp"],
|
||||||
@ -72,7 +76,9 @@ class Map:
|
|||||||
else:
|
else:
|
||||||
actualEntities.append(Entity(entity["name"] + ".png",
|
actualEntities.append(Entity(entity["name"] + ".png",
|
||||||
self.tileSize,
|
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)))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("Failed to load entity " + entity)
|
print("Failed to load entity " + entity)
|
||||||
return actualEntities
|
return actualEntities
|
||||||
@ -120,7 +126,6 @@ class Map:
|
|||||||
result = tile
|
result = tile
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def getTileOnCoord(self, coord):
|
def getTileOnCoord(self, coord):
|
||||||
result = None
|
result = None
|
||||||
for tile in self.terrainTilesList:
|
for tile in self.terrainTilesList:
|
||||||
@ -138,17 +143,6 @@ class Map:
|
|||||||
if not DONTADD:
|
if not DONTADD:
|
||||||
self.entities.append(entity)
|
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
|
# add object to map.collidables list to be collidable
|
||||||
def collision(self, x, y):
|
def collision(self, x, y):
|
||||||
for b in self.collidables:
|
for b in self.collidables:
|
||||||
|
Loading…
Reference in New Issue
Block a user