Skip to content

A Phaser 3 project that uses TypeScript and Vite for bundling

License

Notifications You must be signed in to change notification settings

JuergenHoedl/phaser-vite-ts

 
 

Repository files navigation

Phaser Vite TypeScript Template

This is a Phaser 3 project that uses Vite for bundling. It supports hot-reloading for quick development workflow, includes TypeScript support and scripts to generate production-ready builds.

Versions

Requirements

Node.js is required to install dependencies and run scripts via npm.

Available Commands

Command Description
npm run dev Launch a development web server
npm run build Create a production build in the dist folder

Run the game locally

After cloning the repo, run npm install from your project directory. Then, you can start the local development server by running npm run dev.

The local development server runs on http://localhost:8080 by default.

Contribute

Once the server is running you can edit any of the files in the src folder. Vite will automatically recompile your code and then reload the browser.

Project Structure

We have provided a default project structure to get you started. This is as follows:

  • index.html - A basic HTML page to contain the game.
  • src - Contains the game source code.
  • public/assets - Contains the static assets used by the game.
  • src/main.ts - The main entry point. This contains the game configuration and starts the game.
  • src/vite-env.d.ts - Global TypeScript declarations, provide types information.
  • src/scenes/ - The Phaser Scenes are in this folder.
  • src/data/ - Contains data classes like global game information.
  • src/ui/ - Contains ui objects like a healthbar
  • src/objects/ - Contains game objects like player, NPCs or other objects

Deploying to Production

After you run the npm run build command, your code will be built into a single bundle and saved to the dist folder, along with any other assets your project imported, or stored in the public assets folder.

In order to deploy your game, you will need to upload all of the contents of the dist folder to a public facing web server.

About

A Phaser 3 project that uses TypeScript and Vite for bundling

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 88.1%
  • JavaScript 8.0%
  • HTML 2.5%
  • CSS 1.4%