Jump to content

Problem with updating phaser from 2.0.7


WitheringTreant
 Share

Recommended Posts

Hello, I've recently tried to update phaser from 2.0.7. But using any version of newer phaser starts giving me this one type of errors (this example is from phaser 2.1.3).

 

 

Uncaught TypeError: Cannot read property 'frame' of undefined             VM35 phaser.js:25568

 

Phaser.Input.hitTest                                                     VM35 phaser.js:25568

Phaser.InputHandler.checkPointerDown                  VM35 phaser.js:30622

Phaser.Pointer.processInteractiveObjects                VM35 phaser.js:27864

Phaser.Pointer.update                                                 VM35 phaser.js:27712

Phaser.Input.update                                                    VM35 phaser.js:25236

Phaser.Game.update                                                  VM35 phaser.js:24526

Phaser.RequestAnimationFrame.updateRAF          VM35 phaser.js:42978_onLoop

 

 

The common thing with all of the errors is that they refer to this line (25568 in 2.1.3) in the hitTest function: 

 

var width = displayObject.texture.frame.width;

 

Nothing in the developer tools has referred to anything outside of phaser.js, which is why I have no idea how I would adjust my code to fix this.

 

 

I also noticed this change in 2.1.0 (next release I found from 2.07) which had this following change:

 

  • Resolves issue with pixel perfect click / over detection on Sprites that used trimmed image atlases for animations or frames > 0.

I'm wondering if this change could have somehow caused the problems i am having. It seems to involve something like hitTest does and frames.

 

 

So, I know that this is probably a tricky thing to help someone with. I don't know what to do, and I would prefer not to be stuck in phaser 2.0.7 forever with my gamecode.

Any suggestions about what might cause this conflict are welcome. I would share code but as the errors refer to nothing in my code, I don't know what to share.

Link to comment
Share on other sites

Just a quick guess here (I've seen similar messages previously but perhaps not exactly the same)...

 

Check the latest animations and sprites you have added to your game for errors in the graphic files (preview them all from the desktop and make sure they look ok) and in the way you've referred to them in the preloader (sprite sheet sizes and number of frames, xml files match atlases, etc etc).

 

'undefined' mostly happens when something has failed at a previous stage, and the error stack you have listed is a regular phaser update that happens to expect "displayObject.texture.frame" to be valid.

 

This sort of tracking could be caught automatically at the first point of failure, but that would involve a LOT of extra checks which would reduce performance considerably.  That said, there might be an argument in favour of a dedicated Phaser branch with all of the checks (a "debug" build)... if anyone can be found to maintain it!

Link to comment
Share on other sites

  • 1 month later...

Hey, i finally figured the problem out.

 

When creating buttons:

 

new Button(game, xykeycallbackcallbackContextoverFrameoutFramedownFrameupFrame)

 

I had values on overFrame, outFrame, downFrame which shouldn't have been there.

 

I guess they came when I copied button creation from phaser examples.

 

They caused no problems prior to 2.0.7 but conflicted after updating.

 

So the problem is solved now.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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