From e37a17cadd9932c8973b17a871ba18b53f7ebd5d Mon Sep 17 00:00:00 2001 From: Razrector Date: Sat, 25 Apr 2020 22:49:57 +0200 Subject: [PATCH] Added getTileOnCoord method --- src/game/Map.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/game/Map.py b/src/game/Map.py index 33ce59a..84881a5 100644 --- a/src/game/Map.py +++ b/src/game/Map.py @@ -96,6 +96,13 @@ class Map: result = entity return result + def getTileOnCoord(self, coord): + result = None + for entity in self.terrain: + if entity.rect.x == coord[0] and entity.rect.y == coord[1]: + result = entity + return result + def addEntity(self, entity): self.screen.draw(entity, Locations.MAP, 0, 0) self.collidables.add(entity)