How to use the phaser.Scale function in phaser

To help you get started, we’ve selected a few phaser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mipearson / dungeondash / src / main.ts View on Github external
import Phaser from "phaser";
import ReferenceScene from "./scenes/ReferenceScene";
import DungeonScene from "./scenes/DungeonScene";
import InfoScene from "./scenes/InfoScene";
// import SceneWatcherPlugin from "phaser-plugin-scene-watcher";

new Phaser.Game({
  type: Phaser.WEBGL,
  width: window.innerWidth,
  height: window.innerHeight,
  render: { pixelArt: true },
  physics: { default: "arcade", arcade: { debug: false, gravity: { y: 0 } } },
  scene: [DungeonScene, InfoScene, ReferenceScene],
  scale: {
    mode: Phaser.Scale.RESIZE
  }
  // plugins: {
  //   global: [{ key: "SceneWatcher", plugin: SceneWatcherPlugin, start: true }]
  // }
});
github RyanFleck / Projects / js / rcf051-Phaser02 / src / main.js View on Github external
height: window.innerHeight * window.devicePixelRatio,
    */
    width: 400,
    height: 300,
    scene: [
        LoadScene,
        MenuScene,
        DemoLevel,
    ],
    render: {
        pixelArt: true,
    },
    scale: {
        parent: 'phaser',
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH,
        width: 400,
        height: 300,
    },
});


/* NOTES FOR NEXT TIME:

https://phaser.io/tutorials/coding-tips-005
http://nautil.us/issue/70/variables/how-designers-engineer-luck-into-video-games-rp

- Utilize tiled tilemaps.
- Learn to use the physics engine for collisions.

this.pacman.scale.x = 1;
this.pacman.angle = 0;
github CorayThan / archon-arena / src / game / Game.tsx View on Github external
const height = window.innerHeight - 70

const config: Phaser.Types.Core.GameConfig = {
    parent: "phaser",
    backgroundColor: "#eee",
    type: Phaser.CANVAS,
    width,
    height,
    input: {
        mouse: true,
    },
    render: {
        roundPixels: true,
    },
    scale: {
        mode: Phaser.Scale.RESIZE,
    }
}

class Game extends React.Component {

    state: {
        width: number,
        height: number,
    }
    game: Phaser.Game | undefined
    // Store a state object stripped of proxies defined by mobx
    gameState: GameState | undefined

    constructor(props: Props) {
        super(props)
        this.state = {
github RyanFleck / Projects / js / rcf051-Phaser02 / src / main.js View on Github external
width: window.innerWidth * window.devicePixelRatio,
    height: window.innerHeight * window.devicePixelRatio,
    */
    width: 400,
    height: 300,
    scene: [
        LoadScene,
        MenuScene,
        DemoLevel,
    ],
    render: {
        pixelArt: true,
    },
    scale: {
        parent: 'phaser',
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH,
        width: 400,
        height: 300,
    },
});


/* NOTES FOR NEXT TIME:

https://phaser.io/tutorials/coding-tips-005
http://nautil.us/issue/70/variables/how-designers-engineer-luck-into-video-games-rp

- Utilize tiled tilemaps.
- Learn to use the physics engine for collisions.

this.pacman.scale.x = 1;
github CCDirectLink / crosscode-map-editor / webapp / src / app / components / tile-selector / tile-selector.component.ts View on Github external
ngAfterViewInit() {
		this.scene = new TileSelectorScene();
		this.display = new Phaser.Game({
			width: 400 * window.devicePixelRatio,
			height: 1200 * window.devicePixelRatio,
			type: Phaser.AUTO,
			parent: 'tile-selector-content',
			scale: {
				mode: Phaser.Scale.ScaleModes.NONE,
				zoom: 1 / window.devicePixelRatio
			},
			render: {
				pixelArt: true
			},
			zoom: 1,
			scene: [this.scene]
		});
	}
github CCDirectLink / crosscode-map-editor / webapp / src / app / components / phaser / phaser.component.ts View on Github external
ngOnInit() {
		this.heightMap.init();
		const scene = new MainScene();
		Globals.game = new Phaser.Game({
			width: window.innerWidth * window.devicePixelRatio,
			height: window.innerHeight * window.devicePixelRatio - 64,
			type: Phaser.AUTO,
			parent: 'content',
			scale: {
				mode: Phaser.Scale.ScaleModes.NONE,
				zoom: 1 / window.devicePixelRatio
			},
			render: {
				pixelArt: true
			},
			zoom: 1,
			scene: [scene]
		});
		Globals.scene = scene;
	}
}
github B3L7 / phaser3-tilemap-pack / src / index.js View on Github external
import Phaser from "phaser";

import Preload from './scenes/Preload';
import Level from './scenes/Level';
import HUD from './scenes/HUD';
import GameOver from './scenes/gameOver';

document.body.style.cursor = 'none';    //remove cursor so we can replace it with our crosshair

const config = {
    type: Phaser.AUTO,
    parent: 'phaser-tilemap-pack',
    pixelArt: true,
    clearBeforeRender: false,
    scale: {
        mode: Phaser.Scale.FIT,
        parent: 'phaser-example',
        width: 640,
        height: 360
    },
    physics: {
        default: 'arcade'
    },
    scene: [
    Preload,
    Level,
    HUD,
    GameOver
    ]
};

const game = new Phaser.Game(config);
github rexrainbow / phaser3-rex-notes / examples / gridtable / switch-between-databases.js View on Github external
var addDragContentBehavior = function (table) {
    table.touchState = table.scene.plugins.get('rexTouchState').add(table)
        .on('touchmove', function (pointer) {
            table.addTableOXY(this.dx, this.dy).updateTable();
        });
    return table;
}

var config = {
    type: Phaser.AUTO,
    parent: 'phaser-example',
    width: 800,
    height: 600,
    scale: {
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH,
    },
    scene: Demo,
    plugins: {
        global: [{
            key: 'rexGridTable',
            plugin: GridTablePlugin,
            start: true
        },
        {
            key: 'rexTouchState',
            plugin: TouchStatePlugin,
            start: true
        },
        {
            key: 'rexContainerLite',
            plugin: ContainerLitePlugin,
github damian-pastorini / reldens / src / config / client.js View on Github external
x: 0,
                y: 0
            },
            debug: false
        }
    },
    scale: {
        parent: 'reldens',
        mode: Phaser.Scale.FIT,
        width: 500,
        height: 500,
        min: {
            width: 300,
            height: 500
        },
        autoCenter: Phaser.Scale.CENTER_BOTH
    }
};

module.exports = config;
github rexrainbow / phaser3-rex-notes / examples / gridtable / viewer-database.js View on Github external
var addDragContentBehavior = function (table) {
    table.touchState = table.scene.plugins.get('rexTouchState').add(table)
        .on('touchmove', function (pointer) {
            table.addTableOXY(this.dx, this.dy).updateTable();
        });
    return table;
}

var config = {
    type: Phaser.AUTO,
    parent: 'phaser-example',
    width: 800,
    height: 600,
    scale: {
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH,
    },
    scene: Demo,
    plugins: {
        global: [{
                key: 'rexGridTable',
                plugin: GridTablePlugin,
                start: true
            },
            {
                key: 'rexTouchState',
                plugin: TouchStatePlugin,
                start: true
            },
            {
                key: 'rexContainerLite',
                plugin: ContainerLitePlugin,