phaser
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "phaser" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-a718a33818080585e2d40da8ddb218865d4d056d936404a41ce496d0272a740f. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Phaser expert assistance for developing 2D games with Phaser. Covers the scene system, physics engines (Arcade and Matter.js), sprite animation, tilemaps, tweens, particle effects, and input handling. Suitable for building arcade, puzzle, RPG, platformer, and rogue‑like games, and supports TypeScript and Vite development workflows.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: phaser
description: >-
You are an expert in Phaser, the fast and feature-rich HTML5 game framework
for making 2D games that run in web browsers and mobile devices. You help
developers build arcade games, puzzle games, RPGs, platformers, and
roguelikes using Phaser's scene system, physics engines (Arcade and
Matter.js), sprite animations, tilemaps, tweens, particle effects, and input
handling — with TypeScript support and Vite for modern development workflow.
license: Apache-2.0
compatibility: ''
metadata:
author: terminal-skills
version: 1.0.0
category: Game Development
tags:
- game-engine
- html5
- browser-game
- 2d
- arcade-physics
- webgl
- canvasPhaser — HTML5 Game Framework for Browser Games
You are an expert in Phaser, the fast and feature-rich HTML5 game framework for making 2D games that run in web browsers and mobile devices. You help developers build arcade games, puzzle games, RPGs, platformers, and roguelikes using Phaser's scene system, physics engines (Arcade and Matter.js), sprite animations, tilemaps, tweens, particle effects, and input handling — with TypeScript support and Vite for modern development workflow.
Core Capabilities
Game Configuration
// src/main.ts — Phaser game entry point
import Phaser from "phaser";
import { PreloadScene } from "./scenes/PreloadScene";
import { GameScene } from "./scenes/GameScene";
import { HUDScene } from "./scenes/HUDScene";
const config: Phaser.Types.Core.GameConfig = {
type: Phaser.AUTO, // WebGL → Canvas fallback
width: 800,
height: 600,
pixelArt: true, // No anti-aliasing on sprites
roundPixels: true, // Snap to pixel grid
scale: {
mode: Phaser.Scale.FIT, // Fit viewport, keep aspect ratio
autoCenter: Phaser.Scale.CENTER_BOTH,
},
physics: {
default: "arcade", // Fast AABB physics
arcade: {
gravity: { x: 0, y: 300 }, // Platformer gravity
debug: false,
},
},
scene: [PreloadScene, GameScene, HUDScene],
};
new Phaser.Game(config);
Scene System
// src/scenes/GameScene.ts — Main game loop
export class GameScene extends Phaser.Scene {
private player!: Phaser.Physics.Arcade.Sprite;
private platforms!: Phaser.Physics.Arcade.StaticGroup;
private coins!: Phaser.Physics.Arcade.Group;
private score: number = 0;
constructor() {
super("GameScene");
}
create() {
// Tilemap from Tiled editor
const map = this.make.tilemap({ key: "level-1" });
const tileset = map.addTilesetImage("terrain", "terrain-tiles")!;
const ground = map.createLayer("Ground", tileset)!;
ground.setCollisionByProperty({ collides: true });
// Player with animations
this.player = this.physics.add.sprite(100, 200, "hero");
this.player.setCollideWorldBounds(true);
this.player.setBounce(0.1);
this.anims.create({
key: "run",
frames: this.anims.generateFrameNumbers("hero", { start: 0, end: 5 }),
frameRate: 10,
repeat: -1, // Loop forever
});
// Collisions
this.physics.add.collider(this.player, ground);
// Coins from object layer in Tiled
const coinObjects = map.getObjectLayer("Coins")!.objects;
this.coins = this.physics.add.group();
coinObjects.forEach((obj) => {
const coin = this.coins.create(obj.x!, obj.y!, "coin");
coin.setScale(0.5);
coin.body.setAllowGravity(false);
});
this.physics.add.overlap(this.player, this.coins, this.collectCoin, undefined, this);
// Camera
this.cameras.main.startFollow(this.player, true, 0.08, 0.08);
this.cameras.main.setBounds(0, 0, map.widthInPixels, map.heightInPixels);
// Launch HUD as parallel scene
this.scene.launch("HUDScene");
}
update() {
const cursors = this.input.keyboard!.createCursorKeys();
if (cursors.left.isDown) {
this.player.setVelocityX(-160);
this.player.anims.play("run", true);
this.player.setFlipX(true);
} else if (cursors.right.isDown) {
this.player.setVelocityX(160);
this.player.anims.play("run", true);
this.player.setFlipX(false);
} else {
this.player.setVelocityX(0);
this.player.anims.play("idle", true);
}
// Jump (only when touching ground)
if (cursors.up.isDown && this.player.body!.blocked.down) {
this.player.setVelocityY(-330);
}
}
private collectCoin(
_player: Phaser.GameObjects.GameObject,
coin: Phaser.GameObjects.GameObject,
) {
(coin as Phaser.Physics.Arcade.Sprite).disableBody(true, true);
this.score += 10;
this.events.emit("score-changed", this.score);
// Particle burst effect
const particles = this.add.particles(coin.body!.position.x, coin.body!.position.y, "sparkle", {
speed: 100,
lifespan: 300,
quantity: 8,
scale: { start: 0.5, end: 0 },
emitting: false,
});
particles.explode();
}
}
Physics, Tweens, and Effects
// Arcade physics — fast, axis-aligned
this.physics.add.collider(player, enemies, onHit);
this.physics.add.overlap(bullet, enemies, onBulletHit);
player.setVelocity(200, -300);
player.setBounce(0.2);
player.setDrag(100);
// Matter.js physics — complex shapes, joints, sensors
const ball = this.matter.add.circle(400, 200, 20, { restitution: 0.8 });
const constraint = this.matter.add.constraint(anchor, ball, 100, 0.1);
// Tweens — smooth animations
this.tweens.add({
targets: sprite,
y: sprite.y - 50,
alpha: 0,
duration: 500,
ease: "Power2",
onComplete: () => sprite.destroy(),
});
// Screen shake
this.cameras.main.shake(200, 0.01);
// Time events
this.time.addEvent({
delay: 2000,
callback: spawnEnemy,
loop: true,
});
Installation
# New project with Vite
npm create vite@latest my-game -- --template vanilla-ts
cd my-game
npm install phaser
npm run dev
Best Practices
- Scene system — Use separate scenes for menu, game, HUD, pause, game-over; HUD as parallel scene overlay
- Arcade physics for simple games — AABB collision is fast and sufficient for most 2D games; Matter.js only when you need complex shapes
- Tilemap integration — Design levels in Tiled, export as JSON, load with
this.make.tilemap; use object layers for spawn points - Object pooling — Use
this.physics.add.group({ maxSize: 50 })for bullets, particles, enemies; recycle instead of create/destroy - Pixel art — Set
pixelArt: trueandroundPixels: truein config; prevents blurry scaling on retina displays - Mobile input — Add virtual joystick for touch; Phaser has built-in pointer events for multi-touch
- Texture atlases — Pack sprites into atlases (TexturePacker); reduces draw calls from 200+ to 5-10
- Camera — Use
startFollowwith lerp values (0.05-0.1) for smooth camera; set bounds to tilemap size
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 Phaser 游戏开发能力,涵盖场景系统、物理引擎、动画等核心功能
- 支持 TypeScript 和 Vite 现代开发工作流,具有实际工程价值
- 适用于多种游戏类型:街机、益智、RPG、平台跳跃等
Highlights
- 触发词精准覆盖 Phaser 相关技术栈
- 边界清晰,不易与其他游戏开发 Skill 重叠
- description 完整描述了专家角色和能力范围
Highlights
- 结构清晰,包含配置、场景、物理等完整模块
- 提供端到端代码示例,可直接参考使用
- frontmatter 完整,文档组织规范
Highlights
- 代码示例完整,参数使用正确
- 覆盖主要异常情况和最佳实践
- 提供了可直接执行的 Phaser 配置和场景代码
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 203
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.