mirror of
https://github.com/kristoferssolo/2048.git
synced 2025-10-21 15:20:35 +00:00
feat: add different value posibility
This commit is contained in:
parent
a5a44cb5b5
commit
104fed4705
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user