commit 9b4ae655a1395e9fb1736ad278d2b3d1476e0cc6 Author: Darko Luketic <2694548+dalu@users.noreply.github.com> Date: Wed Feb 19 10:27:08 2020 +0100 initial diff --git a/fuse.js b/fuse.js new file mode 100644 index 0000000..802b6cb --- /dev/null +++ b/fuse.js @@ -0,0 +1,22 @@ +const { FuseBox, WebIndexPlugin } = require("fuse-box"); +const fuse = FuseBox.init({ + homeDir: "src", + target: "browser@es6", + output: "dist/$name.js", + plugins: [ + WebIndexPlugin(), + this.isProduction && + QuantumPlugin({ + uglify: true, + treeshake: true, + bakeApiIntoBundle: "app", + }), + ], +}); +fuse.dev(); // launch http server +fuse + .bundle("app") + .instructions(" > index.ts") + .hmr() + .watch(); +fuse.run(); diff --git a/package.json b/package.json new file mode 100644 index 0000000..c1ee65f --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "phuse", + "version": "1.0.0", + "description": "phase 3 & fusebox starter", + "main": "index.js", + "scripts": { + "start": "node fuse.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "fuse-box": "^3.7.1", + "terser": "^4.6.3", + "typescript": "^3.7.5", + "uglify-js": "^3.8.0" + }, + "dependencies": { + "phaser": "^3.22.0" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..cd1342a --- /dev/null +++ b/src/index.ts @@ -0,0 +1,30 @@ +import Phaser from "phaser"; +import {MainScene} from './scenes/MainScene'; + +export class Game { + phaserGame: Phaser.Game; + config: Phaser.Types.Core.GameConfig; + + constructor() { + this.config = { + type: Phaser.AUTO, + height: 600, + width: 800, + scene: [ MainScene ], + parent: 'gameContainer', + physics: { + default: 'arcade', + arcade: { + gravity: { y: 100 } + } + } + }; + } + + run() { + this.phaserGame = new Phaser.Game(this.config); + } +} + +const game = new Game(); +game.run(); diff --git a/src/scenes/MainScene.ts b/src/scenes/MainScene.ts new file mode 100644 index 0000000..133eccf --- /dev/null +++ b/src/scenes/MainScene.ts @@ -0,0 +1,17 @@ +export class MainScene extends Phaser.Scene { + constructor() { + super({key: 'main'}); + } + + create() { + console.log('create method'); + } + + preload() { + console.log('preload method'); + } + + update() { + console.log('update method'); + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..540e5e5 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "esnext", + "sourceMap": true, + "inlineSources": true, + "importHelpers": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "esModuleInterop": true + }, + "exclude": [ + "node_modules" + ] +}