Kapsonfire Posted May 7, 2014 Share Posted May 7, 2014 I tried out States with phaser and its working for me. Anyways i tried the example with painting the phaserlogo in mid of screen - My Result isnt what I expected. My appclass Game extends Phaser.Game{ constructor() { super(800, 450, Phaser.AUTO, 'content', { preload: this.preload, create: this.create }); this.state.add("Start", Scenes.Start); } preload() { } create() { this.scale.setShowAll(); this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; this.scale.refresh(); this.state.start("Start"); }}window.onload = () => { new Game();};My Statemodule Scenes { export class Start extends Phaser.State { preload() { this.load.image('logo', 'images/phaser2.png'); } create() { } update() { var logo = this.add.sprite(this.world.centerX, this.world.centerY, 'logo'); } }}Result is attached //EDITNevermind, forgot the anchor Link to comment Share on other sites More sharing options...
clark Posted May 7, 2014 Share Posted May 7, 2014 Hey mate Not sure its related to TypeScript exactly. Maybe you missed a line?var logo = this.add.sprite(this.world.centerX, this.world.centerY, 'logo');logo.anchor.x = 0.5;logo.anchor.y = 0.5;Actually I just noticed that Point has set(x/y) and setTo(x/y). Ill check it out, but you could also use logo.anchor.setTo(0.5,0.5) Link to comment Share on other sites More sharing options...
Recommended Posts