From 56844f2bfb6588aa91d9533a51cdb7f8b9366c37 Mon Sep 17 00:00:00 2001 From: hades-cntrl <77414369+hades-cntrl@users.noreply.github.com> Date: Wed, 20 Jan 2021 15:58:39 +1300 Subject: [PATCH 1/5] Update multiple cameras.js --- .../game objects/graphics/multiple cameras.js | 155 +++++++++--------- 1 file changed, 80 insertions(+), 75 deletions(-) diff --git a/public/src/game objects/graphics/multiple cameras.js b/public/src/game objects/graphics/multiple cameras.js index a05180f90..cf09ed24c 100644 --- a/public/src/game objects/graphics/multiple cameras.js +++ b/public/src/game objects/graphics/multiple cameras.js @@ -1,88 +1,93 @@ -var config = { - type: Phaser.WEBGL, - parent: 'phaser-example', - width: 800, - height: 600, - scene: { - create: create, - update: update - }, -}; - -var stars = []; -var cameraRotation = 0; -var camera0, camera1, camera2, camera3; +let i +let stars = []; +let cameraRotation = 0; +let camera0, camera1, camera2, camera3; -var game = new Phaser.Game(config); +class Example extends Phaser.Scene +{ + create () + { + let radius = 20; + let radius2 = radius * 2; + let maxWidth = (400 / radius2)|0; -function create() { + for (let i = 0; i < 80; ++i) + { + let graphics = this.add.graphics({x: radius + (i % maxWidth) * radius2, y: radius + ((i / maxWidth)|0) * radius2}); + this.drawStar(graphics, 0, 0, 5, radius, radius / 2, 0xff0000, 0xFFFF00); + graphics.fillStyle(0xFFFF00 + (i % 0xFF), 1.0); + stars.push(graphics); + stars[i].rotation += 0.1; + } - var radius = 20; - var radius2 = radius * 2; - var maxWidth = (400 / radius2)|0; + this.cameras.main.setSize(400, 300); - for (var i = 0; i < 80; ++i) - { - var graphics = this.add.graphics({x: radius + (i % maxWidth) * radius2, y: radius + ((i / maxWidth)|0) * radius2}); - drawStar(graphics, 0, 0, 5, radius, radius / 2, 0xff0000, 0xFFFF00); - graphics.fillStyle(0xFFFF00 + (i % 0xFF), 1.0); - stars.push(graphics); - stars[i].rotation += 0.1; + camera0 = this.cameras.main; + camera1 = this.cameras.add(400, 0, 400, 300); + camera2 = this.cameras.add(0, 300, 400, 300); + camera3 = this.cameras.add(400, 300, 400, 300); } - this.cameras.main.setSize(400, 300); - - camera0 = this.cameras.main; - camera1 = this.cameras.add(400, 0, 400, 300); - camera2 = this.cameras.add(0, 300, 400, 300); - camera3 = this.cameras.add(400, 300, 400, 300); -} - -function update() { - camera0.scrollX = Math.cos(cameraRotation) * 100; - camera0.scrollY = Math.sin(cameraRotation) * 100; - camera1.shake(100, 0.01); - camera2.flash(2000); - camera3.fade(2000); - camera3.rotation = Math.sin(cameraRotation); - camera3.zoom = 0.5 + Math.abs(Math.sin(cameraRotation)); - if (camera3._fadeAlpha >= 1.0) + update () { - camera3._fadeAlpha = 0.0; - camera3.fade(1000); + camera0.scrollX = Math.cos(cameraRotation) * 100; + camera0.scrollY = Math.sin(cameraRotation) * 100; + camera1.shake(100, 0.01); + camera2.flash(2000); + camera3.fade(2000); + camera3.rotation = Math.sin(cameraRotation); + camera3.zoom = 0.5 + Math.abs(Math.sin(cameraRotation)); + if (camera3._fadeAlpha >= 1.0) + { + camera3._fadeAlpha = 0.0; + camera3.fade(1000); + } + for (let i = 0; i < stars.length; ++i) + { + let star = stars[i]; + star.rotation += 0.01; + star.scaleX = 0.5 + Math.abs(Math.sin(star.rotation)); + star.scaleY = 0.5 + Math.abs(Math.sin(star.rotation)); + } + cameraRotation += 0.01; } - for (var i = 0; i < stars.length; ++i) + + drawStar (graphics, cx, cy, spikes, outerRadius, innerRadius, color, lineColor) { - var star = stars[i]; - star.rotation += 0.01; - star.scaleX = 0.5 + Math.abs(Math.sin(star.rotation)); - star.scaleY = 0.5 + Math.abs(Math.sin(star.rotation)); + let rot = Math.PI / 2 * 3; + let x = cx; + let y = cy; + let step = Math.PI / spikes; + graphics.lineStyle(1, lineColor, 1.0); + graphics.fillStyle(color, 1.0); + graphics.beginPath(); + graphics.moveTo(cx, cy - outerRadius); + for (i = 0; i < spikes; i++) { + x = cx + Math.cos(rot) * outerRadius; + y = cy + Math.sin(rot) * outerRadius; + graphics.lineTo(x, y); + rot += step; + + x = cx + Math.cos(rot) * innerRadius; + y = cy + Math.sin(rot) * innerRadius; + graphics.lineTo(x, y); + rot += step; + } + graphics.lineTo(cx, cy - outerRadius); + graphics.closePath(); + graphics.fillPath(); + graphics.strokePath(); } - cameraRotation += 0.01; } -function drawStar (graphics, cx, cy, spikes, outerRadius, innerRadius, color, lineColor) { - var rot = Math.PI / 2 * 3; - var x = cx; - var y = cy; - var step = Math.PI / spikes; - graphics.lineStyle(1, lineColor, 1.0); - graphics.fillStyle(color, 1.0); - graphics.beginPath(); - graphics.moveTo(cx, cy - outerRadius); - for (i = 0; i < spikes; i++) { - x = cx + Math.cos(rot) * outerRadius; - y = cy + Math.sin(rot) * outerRadius; - graphics.lineTo(x, y); - rot += step; - x = cx + Math.cos(rot) * innerRadius; - y = cy + Math.sin(rot) * innerRadius; - graphics.lineTo(x, y); - rot += step; - } - graphics.lineTo(cx, cy - outerRadius); - graphics.closePath(); - graphics.fillPath(); - graphics.strokePath(); -} +const config = { + type: Phaser.WEBGL, + parent: 'phaser-example', + width: 800, + height: 600, + scene: [ Example ] +}; + +const game = new Phaser.Game(config); + From cc1f97ac7d728bde36b949cfbd4afdae8b00e57b Mon Sep 17 00:00:00 2001 From: hades-cntrl <77414369+hades-cntrl@users.noreply.github.com> Date: Wed, 20 Jan 2021 16:00:25 +1300 Subject: [PATCH 2/5] Update circle overlap.js --- .../game objects/graphics/circle overlap.js | 115 ++++++++++++------ 1 file changed, 79 insertions(+), 36 deletions(-) diff --git a/public/src/game objects/graphics/circle overlap.js b/public/src/game objects/graphics/circle overlap.js index 5e9df5d62..cbe264c51 100644 --- a/public/src/game objects/graphics/circle overlap.js +++ b/public/src/game objects/graphics/circle overlap.js @@ -1,49 +1,92 @@ -var config = { - width: 800, - height: 600, - type: Phaser.CANVAS, - parent: 'phaser-example', - scene: { - create: create, - update: update - } -}; +let i +let stars = []; +let cameraRotation = 0; +let camera0, camera1, camera2, camera3; -var game = new Phaser.Game(config); +class Example extends Phaser.Scene +{ + create () + { + let radius = 20; + let radius2 = radius * 2; + let maxWidth = (400 / radius2)|0; -var t = 0; -var graphics1; -var graphics2; + for (let i = 0; i < 80; ++i) + { + let graphics = this.add.graphics({x: radius + (i % maxWidth) * radius2, y: radius + ((i / maxWidth)|0) * radius2}); + this.drawStar(graphics, 0, 0, 5, radius, radius / 2, 0xff0000, 0xFFFF00); + graphics.fillStyle(0xFFFF00 + (i % 0xFF), 1.0); + stars.push(graphics); + stars[i].rotation += 0.1; + } -function create () -{ - graphics2 = this.add.graphics({x: -16, y: 0}).lineStyle(28, 0x00ffff, 0.8); - graphics1 = this.add.graphics().lineStyle(28, 0x0000ff, 0.8); + this.cameras.main.setSize(400, 300); - // Create the circles + camera0 = this.cameras.main; + camera1 = this.cameras.add(400, 0, 400, 300); + camera2 = this.cameras.add(0, 300, 400, 300); + camera3 = this.cameras.add(400, 300, 400, 300); + } - var radius1 = 64; - var radius2 = 32; + update () + { + camera0.scrollX = Math.cos(cameraRotation) * 100; + camera0.scrollY = Math.sin(cameraRotation) * 100; + camera1.shake(100, 0.01); + camera2.flash(2000); + camera3.fade(2000); + camera3.rotation = Math.sin(cameraRotation); + camera3.zoom = 0.5 + Math.abs(Math.sin(cameraRotation)); + if (camera3._fadeAlpha >= 1.0) + { + camera3._fadeAlpha = 0.0; + camera3.fade(1000); + } + for (let i = 0; i < stars.length; ++i) + { + let star = stars[i]; + star.rotation += 0.01; + star.scaleX = 0.5 + Math.abs(Math.sin(star.rotation)); + star.scaleY = 0.5 + Math.abs(Math.sin(star.rotation)); + } + cameraRotation += 0.01; + } - for (var i = 0; i < 8; i++) + drawStar (graphics, cx, cy, spikes, outerRadius, innerRadius, color, lineColor) { - graphics1.strokeCircle(400, 300, radius1); - graphics2.strokeCircle(400, 300, radius2); + let rot = Math.PI / 2 * 3; + let x = cx; + let y = cy; + let step = Math.PI / spikes; + graphics.lineStyle(1, lineColor, 1.0); + graphics.fillStyle(color, 1.0); + graphics.beginPath(); + graphics.moveTo(cx, cy - outerRadius); + for (i = 0; i < spikes; i++) { + x = cx + Math.cos(rot) * outerRadius; + y = cy + Math.sin(rot) * outerRadius; + graphics.lineTo(x, y); + rot += step; - radius1 += 64; - radius2 += 64; + x = cx + Math.cos(rot) * innerRadius; + y = cy + Math.sin(rot) * innerRadius; + graphics.lineTo(x, y); + rot += step; + } + graphics.lineTo(cx, cy - outerRadius); + graphics.closePath(); + graphics.fillPath(); + graphics.strokePath(); } - } -function update () -{ - t += 0.1; - - graphics1.x += Math.sin(t) * 2; - graphics1.y += Math.cos(t) * 2; - graphics2.x += Math.sin(t) * 3; - graphics2.y += Math.cos(t) * 3; +const config = { + type: Phaser.WEBGL, + parent: 'phaser-example', + width: 800, + height: 600, + scene: [ Example ] +}; -} +const game = new Phaser.Game(config); From ea0ee70024888cae84b87e3740069bcf98e4868f Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 Jan 2021 15:34:37 +1300 Subject: [PATCH 3/5] changed to es6 --- .../game objects/graphics/multiple cameras.js | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/public/src/game objects/graphics/multiple cameras.js b/public/src/game objects/graphics/multiple cameras.js index cf09ed24c..36f93749e 100644 --- a/public/src/game objects/graphics/multiple cameras.js +++ b/public/src/game objects/graphics/multiple cameras.js @@ -1,10 +1,16 @@ -let i -let stars = []; -let cameraRotation = 0; -let camera0, camera1, camera2, camera3; - class Example extends Phaser.Scene { + constructor () + { + super (); + this.stars = []; + this.cameraRotation = 0; + this.camera0 = undefined; + this.camera1 = undefined; + this.camera2 = undefined; + this.camera3 = undefined; + } + create () { let radius = 20; @@ -16,40 +22,40 @@ class Example extends Phaser.Scene let graphics = this.add.graphics({x: radius + (i % maxWidth) * radius2, y: radius + ((i / maxWidth)|0) * radius2}); this.drawStar(graphics, 0, 0, 5, radius, radius / 2, 0xff0000, 0xFFFF00); graphics.fillStyle(0xFFFF00 + (i % 0xFF), 1.0); - stars.push(graphics); - stars[i].rotation += 0.1; + this.stars.push(graphics); + this.stars[i].rotation += 0.1; } this.cameras.main.setSize(400, 300); - camera0 = this.cameras.main; - camera1 = this.cameras.add(400, 0, 400, 300); - camera2 = this.cameras.add(0, 300, 400, 300); - camera3 = this.cameras.add(400, 300, 400, 300); + this.camera0 = this.cameras.main; + this.camera1 = this.cameras.add(400, 0, 400, 300); + this.camera2 = this.cameras.add(0, 300, 400, 300); + this.camera3 = this.cameras.add(400, 300, 400, 300); } update () { - camera0.scrollX = Math.cos(cameraRotation) * 100; - camera0.scrollY = Math.sin(cameraRotation) * 100; - camera1.shake(100, 0.01); - camera2.flash(2000); - camera3.fade(2000); - camera3.rotation = Math.sin(cameraRotation); - camera3.zoom = 0.5 + Math.abs(Math.sin(cameraRotation)); - if (camera3._fadeAlpha >= 1.0) + this.camera0.scrollX = Math.cos(this.cameraRotation) * 100; + this.camera0.scrollY = Math.sin(this.cameraRotation) * 100; + this.camera1.shake(100, 0.01); + this.camera2.flash(2000); + this.camera3.fade(2000); + this.camera3.rotation = Math.sin(this.cameraRotation); + this.camera3.zoom = 0.5 + Math.abs(Math.sin(this.cameraRotation)); + if (this.camera3._fadeAlpha >= 1.0) { - camera3._fadeAlpha = 0.0; - camera3.fade(1000); + this.camera3._fadeAlpha = 0.0; + this.camera3.fade(1000); } - for (let i = 0; i < stars.length; ++i) + for (let i = 0; i < this.stars.length; ++i) { - let star = stars[i]; + let star = this.stars[i]; star.rotation += 0.01; star.scaleX = 0.5 + Math.abs(Math.sin(star.rotation)); star.scaleY = 0.5 + Math.abs(Math.sin(star.rotation)); } - cameraRotation += 0.01; + this.cameraRotation += 0.01; } drawStar (graphics, cx, cy, spikes, outerRadius, innerRadius, color, lineColor) @@ -62,7 +68,7 @@ class Example extends Phaser.Scene graphics.fillStyle(color, 1.0); graphics.beginPath(); graphics.moveTo(cx, cy - outerRadius); - for (i = 0; i < spikes; i++) { + for (let i = 0; i < spikes; i++) { x = cx + Math.cos(rot) * outerRadius; y = cy + Math.sin(rot) * outerRadius; graphics.lineTo(x, y); @@ -80,7 +86,6 @@ class Example extends Phaser.Scene } } - const config = { type: Phaser.WEBGL, parent: 'phaser-example', @@ -90,4 +95,3 @@ const config = { }; const game = new Phaser.Game(config); - From 61a4de11b5bf77cec46eb04b20500cc115e1429f Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 21 Jan 2021 15:36:25 +1300 Subject: [PATCH 4/5] Revert "Update circle overlap.js" on wrong branch This reverts commit cc1f97ac7d728bde36b949cfbd4afdae8b00e57b. --- .../game objects/graphics/circle overlap.js | 115 ++++++------------ 1 file changed, 36 insertions(+), 79 deletions(-) diff --git a/public/src/game objects/graphics/circle overlap.js b/public/src/game objects/graphics/circle overlap.js index cbe264c51..5e9df5d62 100644 --- a/public/src/game objects/graphics/circle overlap.js +++ b/public/src/game objects/graphics/circle overlap.js @@ -1,92 +1,49 @@ -let i -let stars = []; -let cameraRotation = 0; -let camera0, camera1, camera2, camera3; +var config = { + width: 800, + height: 600, + type: Phaser.CANVAS, + parent: 'phaser-example', + scene: { + create: create, + update: update + } +}; -class Example extends Phaser.Scene -{ - create () - { - let radius = 20; - let radius2 = radius * 2; - let maxWidth = (400 / radius2)|0; +var game = new Phaser.Game(config); - for (let i = 0; i < 80; ++i) - { - let graphics = this.add.graphics({x: radius + (i % maxWidth) * radius2, y: radius + ((i / maxWidth)|0) * radius2}); - this.drawStar(graphics, 0, 0, 5, radius, radius / 2, 0xff0000, 0xFFFF00); - graphics.fillStyle(0xFFFF00 + (i % 0xFF), 1.0); - stars.push(graphics); - stars[i].rotation += 0.1; - } +var t = 0; +var graphics1; +var graphics2; - this.cameras.main.setSize(400, 300); +function create () +{ + graphics2 = this.add.graphics({x: -16, y: 0}).lineStyle(28, 0x00ffff, 0.8); + graphics1 = this.add.graphics().lineStyle(28, 0x0000ff, 0.8); - camera0 = this.cameras.main; - camera1 = this.cameras.add(400, 0, 400, 300); - camera2 = this.cameras.add(0, 300, 400, 300); - camera3 = this.cameras.add(400, 300, 400, 300); - } + // Create the circles - update () - { - camera0.scrollX = Math.cos(cameraRotation) * 100; - camera0.scrollY = Math.sin(cameraRotation) * 100; - camera1.shake(100, 0.01); - camera2.flash(2000); - camera3.fade(2000); - camera3.rotation = Math.sin(cameraRotation); - camera3.zoom = 0.5 + Math.abs(Math.sin(cameraRotation)); - if (camera3._fadeAlpha >= 1.0) - { - camera3._fadeAlpha = 0.0; - camera3.fade(1000); - } - for (let i = 0; i < stars.length; ++i) - { - let star = stars[i]; - star.rotation += 0.01; - star.scaleX = 0.5 + Math.abs(Math.sin(star.rotation)); - star.scaleY = 0.5 + Math.abs(Math.sin(star.rotation)); - } - cameraRotation += 0.01; - } + var radius1 = 64; + var radius2 = 32; - drawStar (graphics, cx, cy, spikes, outerRadius, innerRadius, color, lineColor) + for (var i = 0; i < 8; i++) { - let rot = Math.PI / 2 * 3; - let x = cx; - let y = cy; - let step = Math.PI / spikes; - graphics.lineStyle(1, lineColor, 1.0); - graphics.fillStyle(color, 1.0); - graphics.beginPath(); - graphics.moveTo(cx, cy - outerRadius); - for (i = 0; i < spikes; i++) { - x = cx + Math.cos(rot) * outerRadius; - y = cy + Math.sin(rot) * outerRadius; - graphics.lineTo(x, y); - rot += step; + graphics1.strokeCircle(400, 300, radius1); + graphics2.strokeCircle(400, 300, radius2); - x = cx + Math.cos(rot) * innerRadius; - y = cy + Math.sin(rot) * innerRadius; - graphics.lineTo(x, y); - rot += step; - } - graphics.lineTo(cx, cy - outerRadius); - graphics.closePath(); - graphics.fillPath(); - graphics.strokePath(); + radius1 += 64; + radius2 += 64; } + } +function update () +{ + t += 0.1; + + graphics1.x += Math.sin(t) * 2; + graphics1.y += Math.cos(t) * 2; -const config = { - type: Phaser.WEBGL, - parent: 'phaser-example', - width: 800, - height: 600, - scene: [ Example ] -}; + graphics2.x += Math.sin(t) * 3; + graphics2.y += Math.cos(t) * 3; -const game = new Phaser.Game(config); +} From 85c44f0c0577ec25a43ee1065e9daf12712d2b79 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 22 Jan 2021 09:54:29 +1300 Subject: [PATCH 5/5] consistent indentation --- .../game objects/graphics/multiple cameras.js | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/public/src/game objects/graphics/multiple cameras.js b/public/src/game objects/graphics/multiple cameras.js index 36f93749e..925731e63 100644 --- a/public/src/game objects/graphics/multiple cameras.js +++ b/public/src/game objects/graphics/multiple cameras.js @@ -13,85 +13,85 @@ class Example extends Phaser.Scene create () { - let radius = 20; - let radius2 = radius * 2; - let maxWidth = (400 / radius2)|0; + let radius = 20; + let radius2 = radius * 2; + let maxWidth = (400 / radius2)|0; - for (let i = 0; i < 80; ++i) - { - let graphics = this.add.graphics({x: radius + (i % maxWidth) * radius2, y: radius + ((i / maxWidth)|0) * radius2}); - this.drawStar(graphics, 0, 0, 5, radius, radius / 2, 0xff0000, 0xFFFF00); - graphics.fillStyle(0xFFFF00 + (i % 0xFF), 1.0); - this.stars.push(graphics); - this.stars[i].rotation += 0.1; - } + for (let i = 0; i < 80; ++i) + { + let graphics = this.add.graphics({x: radius + (i % maxWidth) * radius2, y: radius + ((i / maxWidth)|0) * radius2}); + this.drawStar(graphics, 0, 0, 5, radius, radius / 2, 0xff0000, 0xFFFF00); + graphics.fillStyle(0xFFFF00 + (i % 0xFF), 1.0); + this.stars.push(graphics); + this.stars[i].rotation += 0.1; + } - this.cameras.main.setSize(400, 300); + this.cameras.main.setSize(400, 300); - this.camera0 = this.cameras.main; - this.camera1 = this.cameras.add(400, 0, 400, 300); - this.camera2 = this.cameras.add(0, 300, 400, 300); - this.camera3 = this.cameras.add(400, 300, 400, 300); + this.camera0 = this.cameras.main; + this.camera1 = this.cameras.add(400, 0, 400, 300); + this.camera2 = this.cameras.add(0, 300, 400, 300); + this.camera3 = this.cameras.add(400, 300, 400, 300); } update () { - this.camera0.scrollX = Math.cos(this.cameraRotation) * 100; - this.camera0.scrollY = Math.sin(this.cameraRotation) * 100; - this.camera1.shake(100, 0.01); - this.camera2.flash(2000); - this.camera3.fade(2000); - this.camera3.rotation = Math.sin(this.cameraRotation); - this.camera3.zoom = 0.5 + Math.abs(Math.sin(this.cameraRotation)); - if (this.camera3._fadeAlpha >= 1.0) - { - this.camera3._fadeAlpha = 0.0; - this.camera3.fade(1000); - } - for (let i = 0; i < this.stars.length; ++i) - { - let star = this.stars[i]; - star.rotation += 0.01; - star.scaleX = 0.5 + Math.abs(Math.sin(star.rotation)); - star.scaleY = 0.5 + Math.abs(Math.sin(star.rotation)); - } - this.cameraRotation += 0.01; + this.camera0.scrollX = Math.cos(this.cameraRotation) * 100; + this.camera0.scrollY = Math.sin(this.cameraRotation) * 100; + this.camera1.shake(100, 0.01); + this.camera2.flash(2000); + this.camera3.fade(2000); + this.camera3.rotation = Math.sin(this.cameraRotation); + this.camera3.zoom = 0.5 + Math.abs(Math.sin(this.cameraRotation)); + if (this.camera3._fadeAlpha >= 1.0) + { + this.camera3._fadeAlpha = 0.0; + this.camera3.fade(1000); + } + for (let i = 0; i < this.stars.length; ++i) + { + let star = this.stars[i]; + star.rotation += 0.01; + star.scaleX = 0.5 + Math.abs(Math.sin(star.rotation)); + star.scaleY = 0.5 + Math.abs(Math.sin(star.rotation)); + } + this.cameraRotation += 0.01; } drawStar (graphics, cx, cy, spikes, outerRadius, innerRadius, color, lineColor) { - let rot = Math.PI / 2 * 3; - let x = cx; - let y = cy; - let step = Math.PI / spikes; - graphics.lineStyle(1, lineColor, 1.0); - graphics.fillStyle(color, 1.0); - graphics.beginPath(); - graphics.moveTo(cx, cy - outerRadius); - for (let i = 0; i < spikes; i++) { - x = cx + Math.cos(rot) * outerRadius; - y = cy + Math.sin(rot) * outerRadius; - graphics.lineTo(x, y); - rot += step; + let rot = Math.PI / 2 * 3; + let x = cx; + let y = cy; + let step = Math.PI / spikes; + graphics.lineStyle(1, lineColor, 1.0); + graphics.fillStyle(color, 1.0); + graphics.beginPath(); + graphics.moveTo(cx, cy - outerRadius); + for (let i = 0; i < spikes; i++) { + x = cx + Math.cos(rot) * outerRadius; + y = cy + Math.sin(rot) * outerRadius; + graphics.lineTo(x, y); + rot += step; - x = cx + Math.cos(rot) * innerRadius; - y = cy + Math.sin(rot) * innerRadius; - graphics.lineTo(x, y); - rot += step; - } - graphics.lineTo(cx, cy - outerRadius); - graphics.closePath(); - graphics.fillPath(); - graphics.strokePath(); + x = cx + Math.cos(rot) * innerRadius; + y = cy + Math.sin(rot) * innerRadius; + graphics.lineTo(x, y); + rot += step; + } + graphics.lineTo(cx, cy - outerRadius); + graphics.closePath(); + graphics.fillPath(); + graphics.strokePath(); } } const config = { - type: Phaser.WEBGL, - parent: 'phaser-example', - width: 800, - height: 600, - scene: [ Example ] + type: Phaser.WEBGL, + parent: 'phaser-example', + width: 800, + height: 600, + scene: [ Example ] }; const game = new Phaser.Game(config);