mirror of
https://github.com/kristoferssolo/2048.git
synced 2025-10-21 15:20:35 +00:00
feat(game): generate new block after move
This commit is contained in:
parent
e45e6b16b3
commit
7fc9e0b644
@ -60,8 +60,9 @@ class Game:
|
|||||||
self.sprites.remove(other_block)
|
self.sprites.remove(other_block)
|
||||||
moved_blocks.add(block)
|
moved_blocks.add(block)
|
||||||
self.update()
|
self.update()
|
||||||
|
self.generate_random_block()
|
||||||
|
|
||||||
def generate_random_block(self, count: int) -> None:
|
def generate_random_block(self, count: int = 1) -> None:
|
||||||
for _ in range(count):
|
for _ in range(count):
|
||||||
while True:
|
while True:
|
||||||
x = random.randint(0, 2) * Config.BLOCK_SIZE # random column position
|
x = random.randint(0, 2) * Config.BLOCK_SIZE # random column position
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user