Merge remote-tracking branch 'origin/passingEvents' into passingEvents

This commit is contained in:
jonspacz 2020-04-05 23:44:28 +02:00
commit 46e2b601f4

View File

@ -1,8 +1,8 @@
import json import json
import pygame import pygame
from game.TerrainTile import TerrainTile from src.game.TerrainTile import TerrainTile
from game.Screen import Locations from src.game.Screen import Locations
from src.entities.Entity import Entity from src.entities.Entity import Entity
from src.entities.Pickupable import Pickupable from src.entities.Pickupable import Pickupable
@ -75,6 +75,13 @@ class Map:
self.screen.draw(object, Locations.MAP, 0, 0) self.screen.draw(object, Locations.MAP, 0, 0)
self.collidables.add(object) self.collidables.add(object)
def getEntityOnCoord(self, coord):
result = None
for entity in self.collidables:
if entity.rect.x == coord[0] and entity.rect.y == coord[1]:
result = entity
return result
def addEntity(self, entity): def addEntity(self, entity):
self.screen.draw(entity, Locations.MAP, 0, 0) self.screen.draw(entity, Locations.MAP, 0, 0)
self.collidables.add(entity) self.collidables.add(entity)