Skip to content

Instantly share code, notes, and snippets.

@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 / 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,
@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 / app.js
Last active Jun 27, 2019
Minimal Phaser 3 setup
View app.js
new Phaser.Game(/* ... */);
@samme
samme / phaser.d.ts
Created May 17, 2018
Phaser v3.8.0 TypeScript definitions, corrected
View phaser.d.ts
This file has been truncated, but you can view the full file.
declare type CallCallback = (item: Phaser.GameObjects.GameObject)=>void;
declare type GridAlignConfig = {
/**
* The width of the grid in items (not pixels). -1 means lay all items out horizontally, regardless of quantity.
* If both this value and height are set to -1 then this value overrides it and the `height` value is ignored.
*/
width?: integer;
/**