从2个或更多Spritesheets创建动画-Phaser

时间:2018-06-26 03:28:48

标签: javascript animation phaser-framework

说我有100个png图像序列(每帧523x482)。

我正在考虑在Spritesheet或Atlas中创建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)

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

1 个答案:

答案 0 :(得分:0)

由于动画系统的工作方式,恐怕在Phaser 2中无法实现。我将其更改为在Phaser 3中可以使用,但是在您的代码中使用的是v2。