Skip to content

Commit

Permalink
1.1.1 minor changes (#4)
Browse files Browse the repository at this point in the history
* Improve readme

* Update package.json
  • Loading branch information
Cerlancism authored Mar 5, 2019
1 parent cfeab2b commit 76fccfd
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 28 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
- Bulk import assets using glob file patterns.
- Hot Module Replacement (fast game reload in browser during development)
- Minification for build output
- Source mapping
- Source mapping (TypeScript breakpoints works with VS Code [Chrome Debugging Extension](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome)).
- Supports modern ECMA syntax as well as typings/intelliSense from [TypeScript](http://www.typescriptlang.org/).
- Browser compatibility down to Internet Explorer 9 with [Babel](https://babeljs.io/) transformations and polyfills.
- The build output playable offline.
- The build output is playable offline.

## Installation
- Recommended editor: [Visual Studio Code](https://code.visualstudio.com/)
- [NodeJS](https://nodejs.org/en/)
- In command-line:
- (Optional) In command-line:
- `npm install -g typescript`
- `npm install -g parcel-bundler`

Expand All @@ -32,14 +32,16 @@ Clone this repository.
Open this folder in Visual Studio code and from menu:
`Terminal -> New Terminal`

`npm start` To develop (work in `src` folder, creates `dev` folder)
`npm install` Download tools and dependencies (one time)

`npm start` To develop (work in `src` folder, creates `dev` folder, open in browser <http://localhost:1234>)

`npm run build` To build (minified and playable offline, creates `build` folder)

`npm run deploy` To deploy (build with no source map, creates `.deploy` folder)

## Important Note
Due to bundling and limitation of mounting Phaser to window scope, do not import Phaser as destructured ES modules, for example:
Due to bundling and limitation of mounting Phaser to window scope, do not import Phaser as destructured ES modules (becareful as this is suggested by auto import), for example:
``` ts
// You can use ES Modules for your own modules.
import { Logger } from '/utilities'
Expand Down
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Phaser CE ParcelJS</title> <style>body,html{margin:0;padding:0}#content{position:fixed;height:100%;width:100%}#content canvas{box-shadow:0 0 5px #000}</style> <script src="src.a9453dea.js"></script> </head> <body> <div id="content"></div> </body> </html>
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Phaser CE ParcelJS</title> <style>body,html{margin:0;padding:0}#content{position:fixed;height:100%;width:100%}#content canvas{box-shadow:0 0 5px #000}</style> <script src="src.83bf30d4.js"></script> </head> <body> <div id="content"></div> </body> </html>
1 change: 0 additions & 1 deletion build/src.18928fda.map

This file was deleted.

22 changes: 11 additions & 11 deletions build/src.a9453dea.js → build/src.83bf30d4.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions build/src.bb53b4fd.map

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phaser-ce-parceljs",
"version": "1.1.0",
"version": "1.1.1",
"description": "Phaser CE boilerplate with typescript, babel and parcel bundler.",
"scripts": {
"start": "parcel serve src/index.html --out-dir dev/",
Expand All @@ -22,16 +22,16 @@
},
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.2",
"@babel/plugin-transform-runtime": "^7.2",
"@babel/preset-env": "^7.3",
"@babel/core": "^7.3.4",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/preset-env": "^7.3.4",
"@types/parcel-env": "^0.0",
"cssnano": "^4.1",
"cssnano": "^4.1.10",
"typescript": "^3.3"
},
"dependencies": {
"@babel/polyfill": "^7.2",
"@babel/runtime": "^7.3",
"phaser-ce": "^2.12"
"@babel/polyfill": "^7.2.5",
"@babel/runtime": "^7.3.4",
"phaser-ce": "^2.12.0"
}
}
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function startGameAsync()

function destroyGame()
{
console.log("[HMR] Destroy Game")
console.log("[HMR]", "Destroy Game")
window.GameInstance.destroy()
delete window.GameInstance
}
}
2 changes: 2 additions & 0 deletions src/states/Boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export class Boot extends Phaser.State
public static key = "Boot"
public static onCreate = new Phaser.Signal()

public key = Boot.key

init()
{
console.log("State", this.key)
Expand Down
1 change: 1 addition & 0 deletions src/states/GamePlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { GameAssetKeys } from "/assets"
export class GamePlay extends Phaser.State
{
public static key = "GamePlay"
public key = GamePlay.key

map: Phaser.Tilemap
layer: Phaser.TilemapLayer
Expand Down
2 changes: 2 additions & 0 deletions src/states/Preloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export class Preloader extends Phaser.State
public static key = "Preloader"
public static onCreate = new Phaser.Signal()

public key = Preloader.key

preloadBar: Phaser.Sprite
preloadText: Phaser.Text

Expand Down

0 comments on commit 76fccfd

Please sign in to comment.