feat: revamp colors

This commit is contained in:
2021-06-10 17:19:27 -04:00
parent b7e0737682
commit 1f182476fd
5 changed files with 42 additions and 26 deletions

View File

@@ -34,15 +34,15 @@ class Tetris:
self.screen = pygame.display.set_mode((win_width, win_height))
self.clock = pygame.time.Clock()
self.main_music = mixer.Channel(0)
self.well = Well((280, 80), ConfigurationManager.configuration["color"]["border"]) # TODO calculate position later and redo color config for well
self.stack = Stack(ConfigurationManager.configuration["color"]["base-4"], ConfigurationManager.configuration["color"]["border"])
self.well = Well((280, 80), ConfigurationManager.configuration["color"]["well-1"], ConfigurationManager.configuration["color"]["well-border-1"]) # TODO calculate position later and redo color config for well
self.stack = Stack(ConfigurationManager.configuration["color"]["stack-1"], ConfigurationManager.configuration["color"]["stack-border-1"])
loaded_icon = pygame.image.load(win_icon)
pygame.display.set_caption(win_title)
pygame.display.set_icon(loaded_icon)
main_music_file = ConfigurationManager.configuration["sound"]["main-music"]
self.main_music.set_volume(0.7)
self.main_music.set_volume(0.7) # TODO add volume to the config
self.main_music.play(mixer.Sound(main_music_file), -1)
# gets called from the games main loop
@@ -81,12 +81,6 @@ class Tetris:
self.current_piece.revert()
if self.stack and self.current_piece.collide(self.stack):
self.current_piece.revert()
if event.key == pygame.K_UP:
self.current_piece.move((0, -self.tile_size))
if self.well and self.current_piece.collide(self.well):
self.current_piece.revert()
if self.stack and self.current_piece.collide(self.stack):
self.current_piece.revert()
if event.key == pygame.K_DOWN:
self.current_piece.move((0, self.tile_size))
if self.well and self.current_piece.collide(self.well):
@@ -104,7 +98,7 @@ class Tetris:
# TODO write not initialized exception
# draw window bg
bg_color = pygame.Color(ConfigurationManager.configuration["window"]["bg-color"])
bg_color = pygame.Color(ConfigurationManager.configuration["color"]["window-bg"])
self.screen.fill(bg_color)
# draw all game objects