Added setter method usage

This commit is contained in:
Marcin Kostrzewski 2020-05-14 11:23:04 +02:00
parent 823eefac86
commit 6ed8423463

View File

@ -49,10 +49,17 @@ class Screen:
# method to draw a sprite. Location param specifies where to draw the item (Locations enum) # method to draw a sprite. Location param specifies where to draw the item (Locations enum)
# TODO: Retarded # TODO: Retarded
def draw(self, sprite, location, posX, posY): def draw(self, sprite, location, posX=0, posY=0):
# TODO: Screen cannot alter sprites position!! # TODO: Screen cannot alter sprites position!!
from entities.Entity import Entity
# For UI, Map, and other sprites
if type(sprite) is not Entity:
sprite.rect.x += posX sprite.rect.x += posX
sprite.rect.y += posY sprite.rect.y += posY
# For entities
else:
sprite.setCoords((posX, posY), True)
if location.value is Locations.RIGHT_UI.value: if location.value is Locations.RIGHT_UI.value:
sprite.rect.x += self.mapCoord + self.mapSize sprite.rect.x += self.mapCoord + self.mapSize
elif location.value == Locations.MAP.value: elif location.value == Locations.MAP.value: