Javascript 从2个或多个精灵表创建动画-相位器

Javascript 从2个或多个精灵表创建动画-相位器,javascript,animation,phaser-framework,Javascript,Animation,Phaser Framework,假设我有一个100幅png图像的序列(每帧523x482) 我正在考虑在一张精灵表或地图集中创建9个图像组。 但是,是否可以从单独的精灵表/地图集创建动画 // frame00 and frame01 are spritesheets with 9 frames. const anim = this.game.add.sprite(265, 70, 'frame_00', 0, scene); anim.animations.add('anim', ['frame_01']); // it do

假设我有一个100幅png图像的序列(每帧523x482)

我正在考虑在一张精灵表或地图集中创建9个图像组。 但是,是否可以从单独的精灵表/地图集创建动画

// frame00 and frame01 are spritesheets with 9 frames.
const anim = this.game.add.sprite(265, 70, 'frame_00', 0, scene);
anim.animations.add('anim', ['frame_01']); // it does not work
anim.animations.play('anim', 30, true);
获取了以下错误:

phaser.min.js:3 Uncaught TypeError: Cannot read property 'index' of undefined
at i.Animation.updateCurrentFrame (phaser.min.js:3)
at i.Animation.play (phaser.min.js:3)
at i.AnimationManager.play (phaser.min.js:3)

如何根据该序列创建动画,或者最好的方法是什么?

由于动画系统的工作方式,恐怕在Phaser 2中不可能做到这一点。我对Phaser 3做了一些修改,使其成为可能,但看看您正在使用的代码v2。

是的,我正在使用Phaser 2:(