From c0e3ff0d3524fff2016c11682b69ca08dce97d49 Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 20 Jan 2021 16:00:00 +1300 Subject: [PATCH 1/3] Pacman arc chomp chomp updated to ES6 --- .../graphics/pacman arc chomp chomp.js | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/public/src/game objects/graphics/pacman arc chomp chomp.js b/public/src/game objects/graphics/pacman arc chomp chomp.js index e9149153b..f5096ea97 100644 --- a/public/src/game objects/graphics/pacman arc chomp chomp.js +++ b/public/src/game objects/graphics/pacman arc chomp chomp.js @@ -1,19 +1,17 @@ -var config = { - width: 800, - height: 600, - backgroundColor: '#010166', - type: Phaser.AUTO, - parent: 'phaser-example', - scene: { - create: create +class Example extends Phaser.Scene +{ + constructor () + { + super(); } -}; -var game = new Phaser.Game(config); + preload () + { + } -function create () -{ - var graphics = this.add.graphics(); + create () + { + let graphics = this.add.graphics(); this.tweens.addCounter({ from: 0, @@ -23,7 +21,7 @@ function create () repeat: -1, onUpdate: function (tween) { - var t = tween.getValue(); + let t = tween.getValue(); graphics.clear(); graphics.fillStyle(0xffff00, 1); @@ -39,4 +37,17 @@ function create () } }); + } } + +const config = { + width: 800, + height: 600, + backgroundColor: '#010166', + type: Phaser.AUTO, + parent: 'phaser-example', + scene: [ Example ] +}; + +const game = new Phaser.Game(config); + From 67e756c3e5cfbcb38a45ed54b3ad65da7c88e2b8 Mon Sep 17 00:00:00 2001 From: Johannes Date: Thu, 21 Jan 2021 11:29:00 +1300 Subject: [PATCH 2/3] Update format --- .../graphics/pacman arc chomp chomp.js | 59 +++++++++---------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/public/src/game objects/graphics/pacman arc chomp chomp.js b/public/src/game objects/graphics/pacman arc chomp chomp.js index f5096ea97..b2f59db89 100644 --- a/public/src/game objects/graphics/pacman arc chomp chomp.js +++ b/public/src/game objects/graphics/pacman arc chomp chomp.js @@ -1,41 +1,37 @@ -class Example extends Phaser.Scene -{ - constructor () - { +class Example extends Phaser.Scene { + constructor () { super(); } - preload () - { + preload () { } create () { - let graphics = this.add.graphics(); - - this.tweens.addCounter({ - from: 0, - to: 30, - duration: 200, - yoyo: true, - repeat: -1, - onUpdate: function (tween) - { - let t = tween.getValue(); - - graphics.clear(); - graphics.fillStyle(0xffff00, 1); - graphics.slice(260, 300, 200, Phaser.Math.DegToRad(330 + t), Phaser.Math.DegToRad(30 - t), true); - graphics.fillPath(); - - graphics.fillStyle(0x000000, 1); - graphics.fillEllipse(260, 180, 30, 90); - - graphics.fillStyle(0xffffff, 1); - graphics.fillCircle(580, 300, 30); - graphics.fillCircle(740, 300, 30); - } - }); + const graphics = this.add.graphics(); + + this.tweens.addCounter({ + from: 0, + to: 30, + duration: 200, + yoyo: true, + repeat: -1, + onUpdate: function (tween) { + let t = tween.getValue(); + + graphics.clear(); + graphics.fillStyle(0xffff00, 1); + graphics.slice(260, 300, 200, Phaser.Math.DegToRad(330 + t), Phaser.Math.DegToRad(30 - t), true); + graphics.fillPath(); + + graphics.fillStyle(0x000000, 1); + graphics.fillEllipse(260, 180, 30, 90); + + graphics.fillStyle(0xffffff, 1); + graphics.fillCircle(580, 300, 30); + graphics.fillCircle(740, 300, 30); + } + }); } } @@ -50,4 +46,3 @@ const config = { }; const game = new Phaser.Game(config); - From 9d710791885d46a00ded640ae0d8fbc7f6987395 Mon Sep 17 00:00:00 2001 From: Heihei03 <22041201+Heihei03@users.noreply.github.com> Date: Fri, 22 Jan 2021 09:47:05 +1300 Subject: [PATCH 3/3] Update pacman arc chomp chomp.js --- .../graphics/pacman arc chomp chomp.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/public/src/game objects/graphics/pacman arc chomp chomp.js b/public/src/game objects/graphics/pacman arc chomp chomp.js index b2f59db89..6d12ecd78 100644 --- a/public/src/game objects/graphics/pacman arc chomp chomp.js +++ b/public/src/game objects/graphics/pacman arc chomp chomp.js @@ -1,11 +1,9 @@ -class Example extends Phaser.Scene { +class Example extends Phaser.Scene + { constructor () { super(); } - preload () { - } - create () { const graphics = this.add.graphics(); @@ -16,7 +14,8 @@ class Example extends Phaser.Scene { duration: 200, yoyo: true, repeat: -1, - onUpdate: function (tween) { + onUpdate: function (tween) + { let t = tween.getValue(); graphics.clear(); @@ -30,13 +29,14 @@ class Example extends Phaser.Scene { graphics.fillStyle(0xffffff, 1); graphics.fillCircle(580, 300, 30); graphics.fillCircle(740, 300, 30); - } + } }); } } -const config = { +const config = +{ width: 800, height: 600, backgroundColor: '#010166',