2dwhatever/src/app.ts

24 lines
544 B
TypeScript

class SimpleGame {
game: Phaser.Game;
constructor() {
this.game = new Phaser.Game(800, 600, Phaser.AUTO, 'content',
{preload: this.preload, create: this.create});
}
preload() {
this.game.stage.backgroundColor = '#ffffff'
this.game.load.image('logo', 'logo.png');
}
create() {
let logo = this.game.add.sprite(this.game.world.centerX, this.game.world.centerY, 'logo');
logo.anchor.setTo(0.5, 0.5);
}
}
window.onload = () => {
let game = new SimpleGame();
}