├── .babelrc ├── .gitignore ├── README.md ├── assets └── phaser3-logo.png ├── package-lock.json ├── package.json ├── src ├── config.js ├── index.html ├── index.js └── scenes │ └── Game.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env" 4 | ] 5 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules/ 3 | 4 | # build 5 | dist/ 6 | 7 | # misc 8 | .DS_Store 9 | .env/ 10 | .cache/ 11 | .vscode/ 12 | .idea 13 | 14 | # Logs 15 | *.log 16 | npm-debug.log* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Phaser 3 + ES6 + Webpack Boilerplate 2 | A boilerplate project for creating games with Phaser3, ES6 and Webpack. 3 | 4 | ## Setup 5 | 6 | ### Environment 7 | Requires node.js and npm to be installed: https://nodejs.org/en/ 8 | 9 | ### Download repo 10 | From your workspace directory run: 11 | 12 | `git clone https://github.com/jedhastwell/phaser3-es6-webpack-boilerplate.git` 13 | 14 | ### Install Dependencies 15 | From the project directory run: 16 | 17 | `npm install` 18 | 19 | ## Usage 20 | 21 | ### Development Server 22 | Starts a development server that will automatically refresh the page as you make changes. Once started, navigate to http://localhost:8080 in your browser. 23 | 24 | To start the server run: 25 | 26 | `npm run start` 27 | 28 | ### Distribution 29 | Bundles and minimises scripts and outputs them along with a copy of the assets/ folder to output directory dist/. 30 | 31 | To build for distribution run: 32 | 33 | `npm run build` -------------------------------------------------------------------------------- /assets/phaser3-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jedhastwell/phaser3-es6-webpack-boilerplate/0779d42bbb0a2fe3da73f9fade30c1bab097d5fd/assets/phaser3-logo.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phaser3-es6-webpack-boilerplate", 3 | "version": "1.0.0", 4 | "description": "A boilerplate project for creating games with Phaser3, ES6 and Webpack", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "webpack-dev-server --mode development", 8 | "build": "webpack --mode production", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "author": "Jed Hastwell", 12 | "repository": "https://github.com/jedhastwell/phaser3-es6-webpack-boilerplate", 13 | "license": "MIT", 14 | "devDependencies": { 15 | "@babel/core": "^7.11.6", 16 | "@babel/preset-env": "^7.11.5", 17 | "babel-loader": "^8.1.0", 18 | "clean-webpack-plugin": "^2.0.2", 19 | "copy-webpack-plugin": "^5.1.2", 20 | "html-loader": "^0.5.5", 21 | "html-webpack-plugin": "^3.2.0", 22 | "raw-loader": "^2.0.0", 23 | "webpack": "^4.44.2", 24 | "webpack-cli": "^3.3.12", 25 | "webpack-dev-server": "^3.11.0" 26 | }, 27 | "dependencies": { 28 | "phaser": "^3.24.1" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/config.js: -------------------------------------------------------------------------------- 1 | import Phaser from 'phaser'; 2 | 3 | export default { 4 | type: Phaser.AUTO, 5 | parent: 'game', 6 | backgroundColor: '#33A5E7', 7 | scale: { 8 | width: 800, 9 | height: 600, 10 | mode: Phaser.Scale.FIT, 11 | autoCenter: Phaser.Scale.CENTER_BOTH, 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |