Giter Club home page Giter Club logo

phaser3-typescript-vite-template's Introduction

Phaser 3 + TypeScript + Vite.js Template

Make Phaser 3 games with TypeScript and modern frontend tooling.

License

This is a TypeScript specific fork of phaser3-vite-template.

Prerequisites

You'll need Node.js and npm installed.

It is highly recommended to use Node Version Manager (nvm) to install Node.js and npm.

For Windows users there is Node Version Manager for Windows.

Install Node.js and npm with nvm:

nvm install node

nvm use node

Replace 'node' with 'latest' for nvm-windows.

Getting Started

You can clone this repository or use degit to scaffold the project like this:

npx degit https://github.com/ourcade/phaser3-typescript-vite-template my-folder-name
cd my-folder-name

npm install

Start development server:

npm run start

To create a production build:

npm run build

Production files will be placed in the dist folder. Then upload those files to a web server. ๐ŸŽ‰

Project Structure

    .
    โ”œโ”€โ”€ dist
    โ”œโ”€โ”€ node_modules
    โ”œโ”€โ”€ public
    โ”œโ”€โ”€ src
    โ”‚   โ”œโ”€โ”€ HelloWorldScene.ts
    โ”‚   โ”œโ”€โ”€ main.ts
	โ”œโ”€โ”€ index.html
    โ”œโ”€โ”€ package.json

TypeScript files are intended for the src folder. main.ts is the entry point referenced by index.html.

Other than that there is no opinion on how you should structure your project.

There is an example HelloWorldScene.ts file that can be placed inside a scenes folder to organize by type or elsewhere to organize by function. For example, you can keep all files specific to the HelloWorld scene in a hello-world folder.

It is all up to you!

Static Assets

Any static assets like images or audio files should be placed in the public folder. It'll then be served from the root. For example: http://localhost:8000/images/my-image.png

Example public structure:

    public
    โ”œโ”€โ”€ images
    โ”‚   โ”œโ”€โ”€ my-image.png
    โ”œโ”€โ”€ music
    โ”‚   โ”œโ”€โ”€ ...
    โ”œโ”€โ”€ sfx
    โ”‚   โ”œโ”€โ”€ ...

They can then be loaded by Phaser with this.image.load('my-image', 'images/my-image.png').

TypeScript ESLint

This template uses a basic typescript-eslint set up for code linting.

It does not aim to be opinionated.

See here for rules to turn on or off.

Dev Server Port

You can change the dev server's port number by modifying the vite.config.ts file. Look for the server section:

{
	// ...
	server: { host: '0.0.0.0', port: 8000 },
}

Change 8000 to whatever you want.

License

MIT License

phaser3-typescript-vite-template's People

Contributors

supertommy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.