Spikes, better gameHandler, map width and height computed automatically & big peanut hard map
This commit is contained in:
+2
-2
@@ -13,11 +13,11 @@ from game.blocks.block import Block
|
||||
class Map:
|
||||
def __init__(self, map_data: dict):
|
||||
self.name = map_data.get('name', 'Unknown')
|
||||
self.width = int(map_data.get('width', 0))
|
||||
self.height = int(map_data.get('height', 0))
|
||||
self.difficulty = float(map_data.get('difficulty', 0.0))
|
||||
self.min_moves = map_data.get('min_moves', None)
|
||||
self.layout = map_data.get('layout', [])
|
||||
self.width = max(len(row) for row in self.layout) if self.layout else 0
|
||||
self.height = len(self.layout) if self.layout else 0
|
||||
|
||||
def get_block_at(self, x, y) -> Block | None:
|
||||
if 0 <= x < self.width and 0 <= y < self.height:
|
||||
|
||||
Reference in New Issue
Block a user