Jump to content

Horizontal Align Problem with Phaser 2.3


turnA
 Share

Recommended Posts

Hi there,

 

I have just updated my games with the latest Phaser 2.3, but it seem now my games will not horizontally aligned to Center like usual, it just stay left aligned. Vertical align has no problem though.

Do anyone have problem like this with Phaser 2.3? 

 

My css in index.html:

		body {			margin: 0;			padding: 0;			background-color: #1d4633;		}		canvas {			padding-left:0;			padding-right:0;			margin-left:auto;			margin-right:auto;			display:block;			width:100%;		}

My scaling and align code in boot.js:

this.stage.backgroundColor = '#1d4633';this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;this.scale.pageAlignHorizontally = true;this.scale.pageAlignVertically = true;

Any help will be greatly appreciated!

Thanks.

Link to comment
Share on other sites

Thank you for your reply icp, but I have problem with the horizontal align, not vertical.
I also want to add that my Phaser/canvas element is located directly on the window element, not under div element or something.

Link to comment
Share on other sites

Try this:

this.stage.backgroundColor = '#1d4633';this.scale.pageAlignHorizontally = true;this.scale.pageAlignVertically = true;this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
Link to comment
Share on other sites

I have tried too icp, unfortunately that doesn't work :(

Thanks for the help though, been pulling my hair for several hours now.

 

I just don't understand, how this thing (aligning) that worked flawesly before, suddenly changed now... 

Link to comment
Share on other sites

Anyone? Is it only me that encounter this problem on Phaser 2.3??

Maybe I can see any example project that can successfully have center horizontal align using Phaser 2.3?

Appreciate any feedback/reply/information...

Link to comment
Share on other sites

@drhayes: Wow, you are right! I must use ONLY the CSS or the horizontalAlign = true; to make it work.

I think that make it easier for new user of Phaser, but it certainly confuse old timer like me who has limited knowledge of CSS and only use old template that works without problem before.

 

Thanks for the help drhayes! :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...