This commit is contained in:
Darko Luketic 2020-02-19 10:27:08 +01:00
commit 9b4ae655a1
5 changed files with 106 additions and 0 deletions

22
fuse.js Normal file
View File

@ -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();

22
package.json Normal file
View File

@ -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"
}
}

30
src/index.ts Normal file
View File

@ -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();

17
src/scenes/MainScene.ts Normal file
View File

@ -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');
}
}

15
tsconfig.json Normal file
View File

@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "esnext",
"sourceMap": true,
"inlineSources": true,
"importHelpers": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true
},
"exclude": [
"node_modules"
]
}