feat: add different value posibility

This commit is contained in:
Kristofers Solo 2023-12-23 22:10:41 +02:00
parent a5a44cb5b5
commit 104fed4705
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,5 @@
import random
import pygame
from .colors import COLORS
@ -11,7 +13,7 @@ class Block(pygame.sprite.Sprite):
self.image.fill(COLORS.ERROR)
self.rect = self.image.get_rect()
self.rect.topleft = (x, y)
self.value = 2
self.value = 2 if random.random() <= Config.BLOCK_VALUE_PROBABILITY else 4
self.draw_value()
def draw_value(self) -> None:

View File

@ -1,6 +1,9 @@
class Config:
WIDTH = 800
HEIGHT = 800
FONT_FAMILY = "Roboto"
FONT_SIZE = 40
BLOCK_SIZE = 200
GRID_SIZE = 4
BLOCK_SIZE = 50
WIDTH = GRID_SIZE * BLOCK_SIZE
HEIGHT = GRID_SIZE * BLOCK_SIZE
INITIAL_BLOCK_COUNT = 2
BLOCK_VALUE_PROBABILITY = 0.9