From 6ed8423463118eb46bc31e4be4502469bd8e9cd2 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Thu, 14 May 2020 11:23:04 +0200 Subject: [PATCH] Added setter method usage --- src/game/Screen.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/game/Screen.py b/src/game/Screen.py index 4a64fee..df334c5 100644 --- a/src/game/Screen.py +++ b/src/game/Screen.py @@ -49,10 +49,17 @@ class Screen: # method to draw a sprite. Location param specifies where to draw the item (Locations enum) # TODO: Retarded - def draw(self, sprite, location, posX, posY): + def draw(self, sprite, location, posX=0, posY=0): # TODO: Screen cannot alter sprites position!! - sprite.rect.x += posX - sprite.rect.y += posY + from entities.Entity import Entity + # For UI, Map, and other sprites + if type(sprite) is not Entity: + sprite.rect.x += posX + sprite.rect.y += posY + # For entities + else: + sprite.setCoords((posX, posY), True) + if location.value is Locations.RIGHT_UI.value: sprite.rect.x += self.mapCoord + self.mapSize elif location.value == Locations.MAP.value: