Giter Site home page Giter Site logo

jamesskemp / phaser-3-vsc-typescript-nodejs Goto Github PK

View Code? Open in Web Editor NEW
22.0 4.0 6.0 1.01 MB

Template for a new Phaser 3 project with Visual Studio Code, TypeScript, and Node.js.

License: MIT License

CSS 1.24% HTML 6.05% TypeScript 77.57% JavaScript 15.14%
phaser3 vscode starter-template typescript javascript-game phaserjs html5-game-development

phaser-3-vsc-typescript-nodejs's Introduction

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

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

If using GitHub, you can use the Use this template button to create a new Phaser 3 project from this starter template.

Get Started

  1. Make sure Node.js is installed.
  2. From a command line, run npm install in the root directory (same place this README.md file is).
  3. Next run npm run start:dev to start an automatically updating instance.
  4. Use the editor of your choice (Visual Studio Code is a great choice) to start writing your game.
  5. Run npm run build to populate the public directory with the final site contents.
  6. Copy the contents of public to the site of your choice.

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.
    • 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 scenes, 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.
  • 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.
  • 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/
  • .eslintignore
    • This file sets which directories/files should not be parsed by eslint.
  • .eslintrc.js
    • This file contains the starting eslint configurations. Base support for TypeScript is included.
    • See ESLint Rules for more information.
  • .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 start 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.

If you'd like to lint your TypeScript/JavaScript, run npm run lint.

Upgrading Phaser

To upgrade Phaser 3 run npm upgrade --save phaser.

Upgrading Other Packages

ESLint:

npm upgrade --save eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser

Once done, run npm run lint to verify everything is still working as expected.

phaser-3-vsc-typescript-nodejs's People

Contributors

jamesskemp avatar

Stargazers

 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  avatar  avatar

phaser-3-vsc-typescript-nodejs's Issues

[Question] How to debug TS in VSCode?

Hello

Thank you for this outstanding template! I have a question.

I'm at very beginning in web-node-etc development and trying set up environment as I did for C++, Rust and so on. I run this template (without any changes) in VSCode: select "Run Script: start:dev". After hitting F5 (or 'play') everything starts (template works), but I all breakpoints is empty circles - 'Unbound breakpoints'.

How I can use this template and debug code inside VSCode? Is there some way to do it?

Thanks

Large hot reload compile time

Hey James,

This is a great template and works really well for a starting point, but I have an issue with hot reload using npm run start:dev. It takes around 10s to compile every time I save, and I was wondering if there is a way to shorten this delay while also keeping hot reload. Overall great work ๐Ÿ‘

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.