phaserについて②
someone
27 3月, 2020
Phaserのテンプレート
var config = { type: Phaser.AUTO, width: 800, height: 600, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); function preload () { } function create () { } function update () { }アセットの読み込み
function preload () { this.load.image('sky', 'assets/sky.png'); this.load.image('ground', 'assets/platform.png'); this.load.image('star', 'assets/star.png'); this.load.image('bomb', 'assets/bomb.png'); this.load.spritesheet('dude', 'assets/dude.png', { frameWidth: 32, frameHeight: 48 } ); }追加要素
function create () { this.add.image(400, 300, 'sky'); this.add.image(400, 300, 'star'); }ああ