refactor: add base class for all game objects
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
from typing import List, Tuple
|
||||
import pygame
|
||||
|
||||
from entity.Entity import Entity
|
||||
from util.ConfigurationManager import ConfigurationManager
|
||||
|
||||
class Well: # TODO game objects base class / interface?
|
||||
class Well(Entity):
|
||||
|
||||
WIDTH = 10 # standard tetris well width, should not be changed
|
||||
HEIGHT = 20 # standard tetris well height, should not be changed
|
||||
|
||||
def __init__(self, position):
|
||||
def __init__(self, position: Tuple):
|
||||
self.points = self.__get_points(position)
|
||||
|
||||
def draw(self, surface):
|
||||
def draw(self, surface: pygame.Surface) -> None:
|
||||
well_color_hex = ConfigurationManager.configuration["color"]["border"] # TODO Should abstract out color call?
|
||||
well_color = pygame.Color(well_color_hex)
|
||||
|
||||
for sub_points in self.points:
|
||||
pygame.draw.polygon(surface, well_color, sub_points, 0)
|
||||
|
||||
def __get_points(self, position):
|
||||
def __get_points(self, position: Tuple) -> List:
|
||||
tile_size = ConfigurationManager.configuration["engine"]["tile-size"]
|
||||
|
||||
shape = []
|
||||
|
||||
Reference in New Issue
Block a user