Skip to content

Instantly share code, notes, and snippets.

@samme
samme / phaser-scenes-summary.md
Last active May 1, 2022
Phaser 3 Scenes Summary
View phaser-scenes-summary.md

Scene control

Calls without a key argument

These affect the calling scene only.

Example:

this.scene.start()

@samme
samme / ScaleX.js
Last active Apr 24, 2020 — forked from nicoptere/ScaleX
Performs a scale2x and scale3x operation on a HTML canvas
View ScaleX.js
/*
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];
}
@samme
samme / base.js
Last active Apr 15, 2020 — forked from tickle-monster/base.js
Phaser 3 BaseScene
View base.js
export class BaseScene extends Phaser.Scene
{
constructor(config)
{
super(config);
}
init()
{
this.user = this.registry.get('user');
@samme
samme / dungeon.txt
Last active Mar 29, 2020
Dungeon. See “Raw”
View dungeon.txt
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░▓ ▓ ▓░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░▓ ▓░░░░░░░░░▓ $ ◆ ▓░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░▓ ⚜︎ ▓░░░░░░░░░▓ ▓ ⚒︎ ▓░░▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░
░░░░░░░░░▓ $ $ ▓▓▓▓▓▓▓▓▓▓▓ ▓ ▓░░▓ ⚱︎ ▓░░░░░
░░░░░░░░░▓ ▓ ⚜︎ $ ▓▓▓◇▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░▓ ▓░░░░░
░░░░░░░░░▓ ▓ ⚑ ▓ ▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓░░░░░
░░░░░░░░░▓ ◆ ▓ ▓ ▓ ▓░░░░░
░░░░░░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ◆ ⚘ ▓ ◇ ▓░░░░░
@samme
samme / main.js
Last active Feb 21, 2020
Switch audio
View main.js
var music = [
{
key: 'bgMusic',
url: 'assets/TownTheme.mp3',
config: {
volume: 0.1,
loop: true
}
},
{
@samme
samme / readme.md
Last active Jan 23, 2020
Phaser.Display.Color conversions
View readme.md
input / output ColorObject Color† HSVColorObject number† string
(h: number, s: number, l: number) HSLToColor
(h: number, s: number, v: number) HSVToRGB HSVToRGB
(r: number, g: number, b: number, a: number) GetColor32
(r: number, g: number, b: number) RGBToHSV RGBToHSV GetColor RGBToString
ColorObject ObjectToColor, ValueToColor
string '#RGB' '#RRGGBB'
@samme
samme / app.js
Last active Jun 27, 2019
Minimal Phaser 3 setup
View app.js
new Phaser.Game(/* ... */);
@samme
samme / html-attributes.md
Last active Apr 6, 2019
Boolean and boolean-like attributes in HTML
View html-attributes.md

Boolean attributes

The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace. The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.

  • allowfullscreen
  • async
  • autofocus
  • autoplay
  • checked
@samme
samme / phaser-test.js
Created Feb 1, 2019
Phaser CE test #617
View phaser-test.js
This file has been truncated, but you can view the full file.
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2016 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*
* @overview
*
* Phaser - http://phaser.io
*
@samme
samme / index.js
Created Jul 11, 2018
GameScalePlugin in phaser3-project-template (webpack)
View index.js
import 'phaser';
import GameScalePlugin from 'phaser-plugin-game-scale';
console.assert(GameScalePlugin, 'GameScalePlugin');
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,