Skip to content

Instantly share code, notes, and snippets.

@samme
Created July 11, 2018 17:57
Show Gist options
  • Save samme/8f9353e8c6e0848ce7f9ad8ebdb8a211 to your computer and use it in GitHub Desktop.
Save samme/8f9353e8c6e0848ce7f9ad8ebdb8a211 to your computer and use it in GitHub Desktop.
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