phaser
Phaserのエキスパートとして、HTML5のゲームフレームワークを使い、Webやモバイルで動作する2Dゲーム開発を支援し、シーン管理や物理エンジン、アニメーションなどを活用して、様々なジャンルのゲームをTypeScriptとViteで効率的に構築するSkill。
📜 元の英語説明(参考)
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.
🇯🇵 日本人クリエイター向け解説
Phaserのエキスパートとして、HTML5のゲームフレームワークを使い、Webやモバイルで動作する2Dゲーム開発を支援し、シーン管理や物理エンジン、アニメーションなどを活用して、様々なジャンルのゲームをTypeScriptとViteで効率的に構築するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o phaser.zip https://jpskill.com/download/15252.zip && unzip -o phaser.zip && rm phaser.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15252.zip -OutFile "$d\phaser.zip"; Expand-Archive "$d\phaser.zip" -DestinationPath $d -Force; ri "$d\phaser.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
phaser.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
phaserフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Phaser — ブラウザゲーム用 HTML5 ゲームフレームワーク
あなたは、ウェブブラウザやモバイルデバイスで動作する2Dゲームを作成するための、高速かつ機能豊富なHTML5ゲームフレームワークであるPhaserのエキスパートです。Phaserのシーンシステム、物理エンジン(ArcadeとMatter.js)、スプライトアニメーション、タイルマップ、Tween、パーティクルエフェクト、および入力処理を使用して、アーケードゲーム、パズルゲーム、RPG、プラットフォーマー、ローグライクを開発者が構築するのを支援します。TypeScriptのサポートと、最新の開発ワークフローのためのViteも利用できます。
主要な機能
ゲーム設定
// src/main.ts — Phaserゲームのエントリーポイント
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フォールバック
width: 800,
height: 600,
pixelArt: true, // スプライトにアンチエイリアスをかけない
roundPixels: true, // ピクセルグリッドにスナップ
scale: {
mode: Phaser.Scale.FIT, // ビューポートに合わせ、アスペクト比を維持
autoCenter: Phaser.Scale.CENTER_BOTH,
},
physics: {
default: "arcade", // 高速なAABB物理演算
arcade: {
gravity: { x: 0, y: 300 }, // プラットフォーマーの重力
debug: false,
},
},
scene: [PreloadScene, GameScene, HUDScene],
};
new Phaser.Game(config);
シーンシステム
// src/scenes/GameScene.ts — メインゲームループ
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() {
// Tiledエディタからのタイルマップ
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 });
// アニメーション付きのプレイヤー
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, // 永久にループ
});
// 衝突
this.physics.add.collider(this.player, ground);
// 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);
// カメラ
this.cameras.main.startFollow(this.player, true, 0.08, 0.08);
this.cameras.main.setBounds(0, 0, map.widthInPixels, map.heightInPixels);
// 並列シーンとしてHUDを起動
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);
}
// ジャンプ(地面に触れているときのみ)
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);
// パーティクルのバーストエフェクト
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();
}
}
物理演算、Tween、エフェクト
// Arcade物理演算 — 高速、軸に沿った
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物理演算 — 複雑な形状、ジョイント、センサー
const ball = this.matter.add.circle(400, 200, 20, { restitution: 0.8 });
const constraint = this.matter.add.constraint(anchor, ball, 100, 0.1);
// Tween — スムーズなアニメーション
this.tweens.add({
targets: sprite,
y: sprite.y - 50,
alpha: 0,
duration: 500,
ease: "Power2",
onComplete: () => sprite.destroy(),
});
// 画面の揺れ
this.cameras.main.shake(200, 0.01);
// 時間イベント
this.time.addEvent({
delay: 2000,
callback: spawnEnemy,
loop: true,
});
インストール
# Viteを使った新しいプロジェクト
npm create vite@latest my-game -- --template vanilla-ts
cd my-game
npm install phaser
npm run dev
ベストプラクティス
- シーンシステム — メニュー、ゲーム、HUD、ポーズ、ゲームオーバーには別々のシーンを使用します。HUDは並列シーンのオーバーレイとして使用します。
- シンプルなゲームにはArcade物理演算 — AABB衝突は高速であり、ほとんどの2Dゲームに十分です。Matter.jsは、複雑な形状が必要な場合にのみ使用します。
- タイルマップの統合 — Tiledでレベルを設計し、JSONとしてエクスポートし、
this.make.tilemapでロードします。スポーンポイントにはオブジェクトレイヤーを使用します。 - オブジェクトプーリング — 弾丸、パーティクル、敵には
this.physics.add.group({ maxSize: 50 })を使用します。作成/破棄する代わりにリサイクルします。 - ピクセルアート — 設定で
pixelArt: trueとroundPixels: trueを設定します。Retinaディスプレイでのぼやけたスケーリングを防ぎます。 - モバイル入力 — 仮想ジョイを追加します。
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Phaser — 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