0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Phaser環境構築方法

0
Last updated at Posted at 2026-08-21

Phaser環境構築方法

1
CLIコマンドを実行する
Phaser公式のセットアップツールを起動します
1.

CLIコマンドを実行する:

Phaser公式のセットアップツールを起動します。

ターミナル(またはコマンドプロンプト)を開き、以下のコマンドを実行します。


Bash
npm create @phaserjs/game@latest
2
対話プロンプトに答える
2.対話プロンプトに答える:

コマンドを実行するといくつか質問されるため、十字キーとEnterを使って以下のように選択していきます。

  1. What framework would you like to use?
    ➔ Vanilla (プレーンな環境。ReactやVueを使いたい場合はそちらを選択)

  2. What bundler would you like to use?
    ➔ Vite

  3. What language would you like to use?
    ➔ TypeScript (または JavaScript)

  4. What is the name of your project?
    ➔ 任意のプロジェクト名(例: my-phaser-game)を入力します。

3
インストールと起動
作成されたディレクトリでサーバーを立ち上げます
3.インストールと起動:作成されたディレクトリでサーバーを立ち上げます。

自動生成されたフォルダに移動し、パッケージをインストールしてから開発サーバーを起動します。

Bash
cd my-phaser-game  # 入力したプロジェクト名
npm install
npm run dev

ターミナルに表示される http://localhost:8080 (または 5173 など)のURLにブラウザでアクセスし、Phaserのデモ画面が表示されれば環境構築は完了です。

公式テンプレートのメリット このツールで作成されたプロジェクトは、あらかじめ src/scenes/ フォルダで画面(シーン)ごとにファイルが分割されており、中規模〜大規模なゲームを作る際のベストプラクティスとなる構造が最初から整っています。また、Vite特有の静的アセット(画像や音声)の読み込み設定も最適化済みです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?