Sign in to follow this  
scofieldly

how to rotate pointer's X Y

Recommended Posts

Hi all, 

Currently I try to rotate the game 90 degree to meet the portrait mode for my [landscape] game, I used other's solution to rotate all display object by

 

this.game.scale.setGameSize(, ;

and 

 

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

    PIXI.DisplayObject.prototype.updateTransform.call(this);
};

 

now all display object are rotated, but the pointer are not rotate, so when I want to do something with activePointer like:
calculation with the mouse position

drag and drop logic

 

the x, y are reversed. 

So I want to know is there any good solution to switch the x, y of the pointer, thx.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.