Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

MarvinB
 Share

Recommended Posts

Hi everyone! I think I placed my last post accidentally in the wrong forum :)

 

So I am running into a little problem and I was searching through several posts without any luck. I used Phaser 2.3 for the game I have been working on for a couple of months now and recently switched to 2.5. The Zoom functionality I was/am using, broke as a result of my update.

I have been using valueerrors' zoom code (as a reference http://www.html5gamedevs.com/topic/10701-camera-zoom-to-mouse-pointer/#comment-63013)

And it works greatly with Phaser 2.3, but unfortunately breaks using 2.5

I made a fiddler adopting his code and added some debugging logs trying to figure out why it breaks. https://jsfiddle.net/61sv9ymL/2/

I hope somebody knows what is going on or can push me into the right direction. One weird thing I noticed is that after zooming and trying to move around, it snaps back to to the top left position, unless you wait till the Focus value 'stabilized'.

I looked at the Phaser example for zooming and also I found this code http://jsfiddle.net/cvcqutgf/ 

But I really liked the zooming functionality I had been using, that's why I am rather looking for a fix.

 

If valueerror is reading this, thank you for sharing your beautiful code! :) 

Link to comment
Share on other sites

Actually, found the issue. 

In Phaser set 

Object.defineProperty(Phaser.Camera.prototype, "position", {

    get: function () {
        this._position.set(this.view.centerX, this.view.centerY);
        return this._position;
    },
}

fixes the issue.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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