summaryrefslogtreecommitdiff
path: root/client/src
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2021-07-12 15:08:48 +0200
committerMike Vink <mike1994vink@gmail.com>2021-07-12 15:08:48 +0200
commit061208705ceb28dac2c69dd8159452fe439cbdc5 (patch)
tree4ad7128aaf7a47ff8da1f3a44efb160ea73ade98 /client/src
add(template): phaser3 template project
Diffstat (limited to 'client/src')
-rw-r--r--client/src/game.ts47
1 files changed, 47 insertions, 0 deletions
diff --git a/client/src/game.ts b/client/src/game.ts
new file mode 100644
index 0000000..40bf5da
--- /dev/null
+++ b/client/src/game.ts
@@ -0,0 +1,47 @@
+import 'phaser';
+
+export default class Demo extends Phaser.Scene
+{
+ constructor ()
+ {
+ super('demo');
+ }
+
+ preload ()
+ {
+ this.load.image('logo', 'assets/phaser3-logo.png');
+ this.load.image('libs', 'assets/libs.png');
+ this.load.glsl('bundle', 'assets/plasma-bundle.glsl.js');
+ this.load.glsl('stars', 'assets/starfields.glsl.js');
+ }
+
+ create ()
+ {
+ this.add.shader('RGB Shift Field', 0, 0, 800, 600).setOrigin(0);
+
+ this.add.shader('Plasma', 0, 412, 800, 172).setOrigin(0);
+
+ this.add.image(400, 300, 'libs');
+
+ const logo = this.add.image(400, 70, 'logo');
+
+ this.tweens.add({
+ targets: logo,
+ y: 350,
+ duration: 1500,
+ ease: 'Sine.inOut',
+ yoyo: true,
+ repeat: -1
+ })
+ }
+}
+
+const config = {
+ type: Phaser.AUTO,
+ backgroundColor: '#125555',
+ width: 800,
+ height: 600,
+ scene: Demo
+};
+
+const game = new Phaser.Game(config);