Skip to content

Instantly share code, notes, and snippets.

@samme
Created Jul 11, 2018
Embed
What would you like to do?
GameScalePlugin in phaser3-project-template (webpack)
import 'phaser';
import GameScalePlugin from 'phaser-plugin-game-scale';
console.assert(GameScalePlugin, 'GameScalePlugin');
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
scene: {
preload: preload,
create: create
},
plugins: {
global: [{ key: 'GameScalePlugin', plugin: GameScalePlugin, mapping: 'gameScale' }]
}
};
var game = new Phaser.Game(config);
function preload ()
{
this.load.image('logo', 'assets/logo.png');
}
function create ()
{
var logo = this.add.image(400, 150, 'logo');
this.tweens.add({
targets: logo,
y: 450,
duration: 2000,
ease: 'Power2',
yoyo: true,
loop: -1
});
console.assert(this.gameScale, 'this.gameScale');
console.log('this.gameScale', this.gameScale);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment