phaser-starter-templates/v2-ce/_starter-v2-ce-vsc-ts-node
James Skemp a4a21a09bb Fix npm audit issues 2022-07-23 20:02:08 -05:00
..
.vscode Add existing non-simple templates for Phaser 2.x versions 2018-02-11 13:56:28 -06:00
src Fix some tslint issues in Phaser CE template 2018-10-22 21:17:20 -05:00
.editorconfig Replace Gulp with Webpack for Phaser CE starter project 2018-10-20 14:51:21 -05:00
.gitignore Replace Gulp with Webpack for Phaser CE starter project 2018-10-20 14:51:21 -05:00
.gitlab-ci.yml Replace Gulp with Webpack for Phaser CE starter project 2018-10-20 14:51:21 -05:00
README.md Replace Gulp with Webpack for Phaser CE starter project 2018-10-20 14:51:21 -05:00
package-lock.json Fix npm audit issues 2022-07-23 20:02:08 -05:00
package.json Update all packages 2022-07-23 19:40:26 -05:00
tsconfig.json Replace Gulp with Webpack for Phaser CE starter project 2018-10-20 14:51:21 -05:00
tslint.json Replace Gulp with Webpack for Phaser CE starter project 2018-10-20 14:51:21 -05:00
webpack.config.js Update Webpack and TypeScript-related npm packages 2020-01-25 14:29:55 -06:00

README.md

Starter Project for Phaser 2 CE with Visual Studio Code, TypeScript, and NodeJS

The following is a starter project to get started with a new game in Phaser 2 CE and Visual Studio Code, using TypeScript and NodeJS.

What This Project Provides

  • src
    • assets
      • This directory can be used to store any assets (images, audio, etcetera) that your game will use.
    • plugins
      • This directory is intended to store any plugins that are used by your game.
      • A collection of plugins can be found in the Phaser Plugins repository.
    • ts
      • This directory is intended to store your TypeScript files, and includes a .gitignore so that any JavaScript files that are built aren't committed.
      • A possible directory structure, as well as a few starter states, have been added for ease, but can be removed without issue.
    • app.css can include any styling necessary for your application.
    • favicon.ico
    • index.html
      • The title and h1 elements should be updated to match the needs of your game.
      • Includes a reference to the minified Phaser library.
      • Also includes a reference to a JavaScript file, which the Visual Studio project is setup to output TypeScript files to, and which should be updated to match your needs.
  • gulpfile.js includes gulp tasks used to build the site.
  • package.json contains the Node packages used by this project.
  • README.md is this file, and should be replaced with whatever content is needed for your game.
  • tsconfig.json
    • This file determines how TypeScript will compile the project.
    • By default all TypeScript files will be compiled into a single app.js file in the root of the project.
  • tslint.json
    • This file contains the default TSLint configuration. See Configuring TSLint for more information.
  • webpack.config.js
    • This file contains the default webpack configuration.
  • .editorconfig
    • "EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs." See https://editorconfig.org/
  • .gitlab-ci.yml
  • .vscode/tasks.json
    • Used by Visual Studio Code when running the build task.

How to Build the Site

To build this project you'll need Node.js installed.

Next run npm install in the root directory to install the various dependencies.

Run npm run build after modifying code to populate the public directory with the final site contents. You can instead run npm run build-dev to build the JavaScript in development mode, or npm run start:dev to run an automatically updating instance.

If you'd like to run a simple web server, install http-server via npm install http-server -g, which can then be run from the public directory by running http-server.

Upgrading Phaser 2 CE

To upgrade Phaser 2 CE run npm upgrade phaser-ce (passing npm upgrade phaser-ce --save if you wish to update the package.json).