Phaser 3 TileMap Snippets

create tile map
Description:creates a tilemap object
Example:const map = this.make.tilemap({ key: "map", tileWidth: 16, tileHeight: 16 });

Add Tileset Images
Description:adds the images needed to the map
Example:map.addTilesetImage("tiles");

Add Layer to Map
Description:adds a static layer to a map. This will allow you to put images below, above, or on the same index as the player.
Example:const layer = map.createLayer(0, tileset, 0, 0);

Load Tiled JSON
Description:Loads a JSON file to use for layer data
Example:this.load.tilemapTiledJSON("map", "town.json");

create tilemap from an array
Description:creates a tilemap object using a 2D array myArray=[[0,1,2],[3,4,5],[3,2,1]]
Example:const map = this.make.tilemap({ data: myArray, tileWidth: 16, tileHeight: 16 });

Add Tileset Images with Json
Description:adds the images needed to the map
Example: const tileset = map.addTilesetImage("Tiles1",'ts');