phaserjs avatar

Tilemaps

Handles all the tilemap plumbing in Phaser 4, from loading Tiled JSON to setting up collision and rendering layers. You get two layer types: the standard TilemapLayer for flexibility and TilemapGPULayer for performance when you can live with a single tileset and orthographic maps only. The collision setup is straightforward with methods like setCollision, setCollisionByProperty, and setCollisionByExclusion. One thing to watch: GPU layers don't auto-update when you edit tiles, so you need to call generateLayerDataTexture() manually. The documentation covers the usual pain points like matching layer names from Tiled and linking tileset images correctly. Solid reference if you're building tile-based games and don't want to dig through source code.

skills.sh installs
1.1K
GitHub stars
40.7K
last updated
Aug 21, 2026

Install

$ npx -y skills add phaserjs/phaser --skill tilemaps --agent claude-code

Installs into .claude/skills of the current project.

Files

Tilemaps

Phaser Tilemaps render tile-based levels from Tiled JSON, CSV, or raw 2D arrays. A Tilemap holds parsed map data and provides methods to add tilesets, create layers, set collision, and query tiles. Layers (TilemapLayer or TilemapGPULayer) are the Game Objects that actually render tiles. Phaser supports orthogonal, isometric, hexagonal, and staggered maps.

Key source paths: src/tilemaps/Tilemap.js, src/tilemaps/TilemapLayer.js, src/tilemaps/TilemapGPULayer.js, src/tilemaps/TilemapLayerBase.js, src/tilemaps/Tile.js, src/tilemaps/Tileset.js, src/tilemaps/TilemapFactory.js, src/tilemaps/components/, src/tilemaps/parsers/tiled/ Related skills: ../loading-assets/SKILL.md, ../sprites-and-images/SKILL.md

Quick Start

class GameScene extends Phaser.Scene {
    preload() {
        // Load the Tiled JSON and the tileset image
        this.load.tilemapTiledJSON('map', 'assets/level1.json');
        this.load.image('tiles', 'assets/tilesheet.png');
    }

    create() {
        // Create the tilemap from cached JSON
        const map = this.add.tilemap('map');

Sponsors

Details

Repository
github.com/phaserjs/phaser
Category
Game Development
First seen
Jun 3, 2026

More from phaserjs/phaser

All 8
1inference-sh avatarai-music-generationinference-sh/skillsGenerate AI music and songs with ElevenLabs, Diffrythm, Tencent Song Generation via inference.sh CLI. Models: ElevenLabs Music (up to 10 min, commercial license1.1Kskills.sh installs
2phaserjs avatarv4-new-featuresphaserjs/phaserUse this skill when learning about new features, game objects, components, and rendering capabilities added in Phaser 4. Covers Filters, RenderNodes, CaptureFra1.1Kskills.sh installs
3phaserjs avataraudio-and-soundphaserjs/phaserUse this skill when adding audio or sound to a Phaser 4 game. Covers loading audio, playing sounds, music, volume, spatial audio, Web Audio API, and SoundManage1.1Kskills.sh installs
4machina-sports avatarnba-datamachina-sports/sports-skillsNBA data via ESPN public endpoints, the NBA live CDN, and NBA Stats (stats.nba.com) — scores, standings, rosters, schedules, game summaries, play-by-play, injur1Kskills.sh installs
5heygen-com avatarvisual-styleheygen-com/skillsCreate, extract, and apply portable visual design systems via visual-style.md files. Use when: (1) Creating a visual-style.md design system from scratch, (2) Ex921skills.sh installs
6machina-sports avatarmarketsmachina-sports/sports-skillsMarkets orchestration — connects ESPN live schedules with Kalshi and Polymarket prediction markets. Unified dashboards, odds comparison, entity search, and bet 900skills.sh installs