refactor: add base class for all game objects
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import pygame
|
||||
|
||||
from util.ConfigurationManager import ConfigurationManager
|
||||
from util.PieceGenerator import PieceGenerator
|
||||
from entity.Well import Well
|
||||
@@ -15,7 +16,7 @@ class Tetris:
|
||||
self.well = None
|
||||
self.current_piece = None
|
||||
|
||||
def initialize(self):
|
||||
def initialize(self) -> None:
|
||||
pygame.init()
|
||||
|
||||
win_width = ConfigurationManager.configuration["window"]["width"]
|
||||
@@ -34,7 +35,7 @@ class Tetris:
|
||||
pygame.display.set_icon(loaded_icon)
|
||||
|
||||
# gets called from the games main loop
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
# TODO write not initialized exception
|
||||
|
||||
self.clock.tick(self.fps)
|
||||
@@ -58,8 +59,10 @@ class Tetris:
|
||||
self.current_piece.move((0, self.tile_size))
|
||||
if event.key == pygame.K_z:
|
||||
self.__generate_piece((300, 100))
|
||||
if event.key == pygame.K_x:
|
||||
self.current_piece.revert()
|
||||
|
||||
def draw(self):
|
||||
def draw(self) -> None:
|
||||
# TODO write not initialized exception
|
||||
|
||||
# draw window bg
|
||||
|
||||
Reference in New Issue
Block a user