This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { asin, cos, random, PI } = Math; | |
| // Average 0.333 | |
| const Low = () => random() ** 2; | |
| // Average 0.666 | |
| const High = () => 1 - random() ** 2; | |
| // Average 0.5, middle-biased | |
| const Mid = () => 0.5 + asin(2 * random() - 1) / PI; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Phaser from 'phaser'; | |
| const playerPositions = { | |
| 1: { x: 112, y: 112 }, | |
| 2: { x: 1376, y: 160 }, | |
| 3: { x: 2000, y: 48 }, | |
| 4: { x: 2176, y: 144 }, | |
| }; | |
| export class GameScene extends Phaser.Scene { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 0x00000f (15) to '#00000f' | |
| '#' + (0x00000f).toString(16).padStart(6, '0') | |
| // '#00000f' to 0x00000f (15) | |
| parseInt('0x' + '#00000f'.slice(1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* global Phaser */ | |
| // GlobalClock | |
| // Modified from Phaser.Time.Clock by Richard Davey © 2013-2023 Photon Storm Ltd. <https://opensource.org/licenses/MIT> | |
| class GlobalClock { | |
| constructor(pluginManager) { | |
| this.pluginManager = pluginManager; | |
| this.game = pluginManager.game; | |
| this.now = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const gameConfig = { | |
| scene: { | |
| create: function () { | |
| this.add.text(0, 0, "Hello world"); | |
| } | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const gameConfig = { | |
| scene: { | |
| create: function () { | |
| this.add.text(0, 0, "Hello world"); | |
| } | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| JavaScript port of <http://scale2x.sourceforge.net/algorithm.html> | |
| */ | |
| var scaleX = (function (exports) { | |
| function getPixel32(data, x, y, w) { | |
| var id = (x + y * w) * 4; | |
| return (data[id] << 16) | (data[id + 1] << 8) | data[id + 2]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export class BaseScene extends Phaser.Scene | |
| { | |
| constructor(config) | |
| { | |
| super(config); | |
| } | |
| init() | |
| { | |
| this.user = this.registry.get('user'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | |
| ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░ | |
| ░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░▓ ▓ ▓░░░░░░░░░░░░░░░░░░░░ | |
| ░░░░░░░░░▓ ▓░░░░░░░░░▓ $ ◆ ▓░░░░░░░░░░░░░░░░░░░░ | |
| ░░░░░░░░░▓ ⚜︎ ▓░░░░░░░░░▓ ▓ ⚒︎ ▓░░▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░ | |
| ░░░░░░░░░▓ $ $ ▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓░░▓ ⚱︎ ▓░░░░░ | |
| ░░░░░░░░░▓ ▓ ⚜︎ $ ▓▓▓◇▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░▓ ▓░░░░░ | |
| ░░░░░░░░░▓ ▓ ⚑ ▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓░░░░░ | |
| ░░░░░░░░░▓ ◆ ▓ ▓ ▓ ▓░░░░░ | |
| ░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ◆ ⚘ ▓ ◇ ▓░░░░░ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var music = [ | |
| { | |
| key: 'bgMusic', | |
| url: 'assets/TownTheme.mp3', | |
| config: { | |
| volume: 0.1, | |
| loop: true | |
| } | |
| }, | |
| { |
NewerOlder