Implement a procedural map generator using a cellular automata algorithm and integrate it with the existing tilemap management system.
Map Generator: Add MapGenerator class in src/utils/MapGenerator.ts with a static method generateMap that generates a 2D array of booleans using a cellular automata algorithm.
Initialize the map with random values.
Iterate through the map for a predefined number of steps, applying rules based on the number of filled neighbors.
Return the generated 2D array of booleans.
Tilemap Manager: Update TilemapManager class in src/utils/TilemapManager.ts to use the MapGenerator for populating the tilemap.
Import MapGenerator class.
Add a method populateTilemap that takes a 2D array of booleans and sets the tiles accordingly.
Use MapGenerator to generate the map and call populateTilemap in the constructor.
Play Scene: Update PlayScene class in src/scenes/PlayScene.ts to use the MapGenerator and TilemapManager.
Import MapGenerator class.
Generate the map using MapGenerator and pass it to TilemapManager.
Call populateTilemap method of TilemapManager with the generated map in the create method.
Related to #17
Implement a procedural map generator using a cellular automata algorithm and integrate it with the existing tilemap management system.
Map Generator: Add
MapGenerator
class insrc/utils/MapGenerator.ts
with a static methodgenerateMap
that generates a 2D array of booleans using a cellular automata algorithm.Tilemap Manager: Update
TilemapManager
class insrc/utils/TilemapManager.ts
to use theMapGenerator
for populating the tilemap.MapGenerator
class.populateTilemap
that takes a 2D array of booleans and sets the tiles accordingly.MapGenerator
to generate the map and callpopulateTilemap
in the constructor.Play Scene: Update
PlayScene
class insrc/scenes/PlayScene.ts
to use theMapGenerator
andTilemapManager
.MapGenerator
class.MapGenerator
and pass it toTilemapManager
.populateTilemap
method ofTilemapManager
with the generated map in thecreate
method.For more details, open the Copilot Workspace session.