phaserjs avatar

Loading Assets

Everything you need to get assets into Phaser 4. This covers the full Loader plugin API: images, spritesheets, atlases (JSON, XML, Unity, Aseprite), audio with fallback formats, tilemaps from Tiled or CSV, bitmap fonts, video, web fonts, and JSON data. The preload pattern is solid here, assets load in parallel and cache globally across scenes, and you get proper progress tracking with events. The URL resolution section (baseURL, path, prefix) is genuinely useful for organizing large projects or working with CDNs. Also shows how to load assets outside preload if you need runtime loading. If you're moving assets around or building loading screens, the events and pack file examples will save you time.

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

Install

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

Installs into .claude/skills of the current project.

Files

Loading Assets

The Phaser Loader (this.load) handles fetching all external content: images, audio, JSON, tilemaps, atlases, fonts, scripts, and more. Assets are queued in preload(), loaded in parallel, and placed into global caches accessible by every Scene.

Key source paths: src/loader/LoaderPlugin.js, src/loader/File.js, src/loader/filetypes/, src/loader/events/ Related skills: ../game-setup-and-config/SKILL.md, ../scenes/SKILL.md, ../sprites-and-images/SKILL.md

Quick Start

class GameScene extends Phaser.Scene {
    preload() {
        this.load.image('logo', 'assets/logo.png');
    }

    create() {
        this.add.image(400, 300, 'logo');
    }
}

Assets loaded in preload() are guaranteed to be ready when create() runs. The Loader starts automatically during the preload phase.

Core Concepts

The Preload Pattern

Every Scene can define a preload() method. The Loader automatically starts when preload() completes and waits for all queued files to finish before calling create().

Sponsors

Details

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

More from phaserjs/phaser

All 8

Recommended

1juliusbrussee avatarcavemanjuliusbrussee/cavemanUltra-compressed communication mode. Cuts output tokens 65% (measured) by speaking like caveman while keeping full technical accuracy. Supports intensity levels618.3Kskills.sh installs
2mattpocock avatargrill-memattpocock/skillsA relentless interview to sharpen a plan or design.1.5Mskills.sh installs
3shadcn avatarimproveshadcn/improveSurvey any codebase as a senior advisor and produce prioritized, self-contained implementation plans for OTHER models/agents to execute. Strictly read-only on s40Kskills.sh installs
4obra avatarsystematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes326.7Kskills.sh installs
5forrestchang avatarkarpathy-guidelinesforrestchang/andrej-karpathy-skillsBehavioral guidelines to reduce common LLM coding mistakes through explicit assumptions, simplicity, and verifiable success criteria.17.9Kskills.sh installs
6vercel-labs avatarfind-skillsvercel-labs/skillsHelps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express int4.3Mskills.sh installs