From 46712749b67c43fdbf839cd4ba171629f810b9c8 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Thu, 2 Apr 2020 18:31:21 +0200 Subject: [PATCH] Added alpha draw method --- src/game/Screen.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/game/Screen.py b/src/game/Screen.py index 7bed8ff..7e59ebc 100644 --- a/src/game/Screen.py +++ b/src/game/Screen.py @@ -1,4 +1,6 @@ import math +from enum import Enum + import pygame # minimum UI width @@ -33,3 +35,20 @@ class Screen: result = expectedSize return result + + # method to draw a sprite. Location param specifies where to draw the item (Locations enum) + def draw(self, sprite, location, posX, posY): + sprite.rect.x += posX + sprite.rect.y += posY + if location.value is Locations.RIGHT_UI.value: + sprite.rect.x += self.mapCoord + self.mapSize + elif location.value == Locations.MAP.value: + sprite.rect.x += self.mapCoord + self.gameObject.spritesList.add(sprite) + + +# screen locations enum +class Locations(Enum): + RIGHT_UI = 1 + LEFT_UI = 2 + MAP = 3