phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
http://phaser.io
MIT License
1.34k stars 491 forks source link

AnimationManager.play() report errors #620

Closed buxin closed 4 years ago

buxin commented 5 years ago

AnimationManager.play() report errors, because when updateCurrentFrame. there this currentFrame is null. ` // Previous index var idx = this.currentFrame.index;

    this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]); // here!!!

    if (this.currentFrame && (fromPlay || (!fromPlay && idx !== this.currentFrame.index)))
    {
        this._parent.setFrame(this.currentFrame);
    }`

Uncaught TypeError: Cannot read property 'index' of undefined at ./node_modules/source-map-loader/index.js!./node_modules/phaser-ce/build/custom/phaser-split.js.Phaser.Animation.updateCurrentFrame (main.js:347707) at ./node_modules/source-map-loader/index.js!./node_modules/phaser-ce/build/custom/phaser-split.js.Phaser.Animation.play (main.js:347390) at ./node_modules/source-map-loader/index.js!./node_modules/phaser-ce/build/custom/phaser-split.js.Phaser.AnimationManager.play (main.js:346893)

Weedshaker commented 5 years ago

1) Does your code snippet above belong to index.js? 2) Does "this.currentFrame.index" throw the error?

if you can answer both with yes, could you please post your compiled (raw) code of that snippet.