feat(game): add log output

import logger
This commit is contained in:
Kristofers Solo 2023-12-28 18:25:20 +02:00
parent b533946471
commit 56f32f7b4a
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,7 @@
import random
import pygame
from loguru import logger
from .colors import COLORS
from .config import Config
@ -28,13 +29,11 @@ class Block(pygame.sprite.Sprite):
new_x = self.rect.x + dx
new_y = self.rect.y + dy
if 0 <= new_x <= Config.WIDTH - Config.BLOCK_SIZE and 0 <= new_y <= Config.HEIGHT - Config.BLOCK_SIZE:
logger.debug(f"Moving block({id(self)}): ({self.rect.x}, {self.rect.y}) => ({new_x}, {new_y})")
self.rect.x = new_x
self.rect.y = new_y
def increase_value(self, num: int = 2) -> None:
"""Increase the value of the block `num` times"""
self.value *= num
self.update()
else:
logger.debug("Move blocked: out of bounds")
def update(self) -> None:
"""Update the block"""

View File

@ -104,6 +104,7 @@ class Game:
if not colliding_blocks:
self.sprites.add(block)
logger.debug(f"Generated block({id(block)}) at ({x}, {y})")
break
def exit(self) -> None: