Jump to content

how to do rotation in phaser 3


Recommended Posts

I need help with one more thing and this is the most important part. If you look at this game (http://game.webxinxin.com/tacit/) , when you go to portrait mode, it doesn’t show the game in a portrait mode, but still shows in landscape mode even if you’re in a portrait mode. So if you’re in a portrait mode, you still have to rotate the screen in order to play.



When I did this,

mode: Phaser.Scale.ENVELOP,
autoCenter: Phaser.Scale.CENTER_BOTH,



It shows the game in portrait mode directly which just is bad because it shows the game in a bad shape. So is there a way to show the game in a portrait mode as on that game link I posted?

The way this is handled in that game link is the following code:


Phaser.World.prototype.displayObjectUpdateTransform = function() {
if(!game.scale.correct) {
this.x = game.camera.y + game.width;
this.y = -game.camera.x;
this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(90));
} else {
this.x = -game.camera.x;
this.y = -game.camera.y;
this.rotation = 0;



but i have no idea how to implement this code in phaser 3. what is even PIXI? or Phaser.World? this code directly doesn’t work in Phaser 3. Any idea?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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