Javascript Phaser动画帮助-将动画链接在一起
我正在尝试使用phaser将动画链接在一起 当intro0完成时,我需要播放intro1中定义的动画。 但是,简介1中的动画会不断循环。我需要一种停止现有动画的方法来启动新动画 如果我在简介1中使用this.player.animations.stop,则所有动画都会停止。空闲动画不会运行 有人能帮忙吗Javascript Phaser动画帮助-将动画链接在一起,javascript,phaser-framework,Javascript,Phaser Framework,我正在尝试使用phaser将动画链接在一起 当intro0完成时,我需要播放intro1中定义的动画。 但是,简介1中的动画会不断循环。我需要一种停止现有动画的方法来启动新动画 如果我在简介1中使用this.player.animations.stop,则所有动画都会停止。空闲动画不会运行 有人能帮忙吗 intro0: function() { this.player.animations.play("run", 9, true); var s = this.game.add.tween
intro0: function() {
this.player.animations.play("run", 9, true);
var s = this.game.add.tween(this.player);
s.to({ y: 300,x:192 }, 3000, null)
s.start();
s.onComplete.add(this.intro1, this); //Which uses the Signals retains scope
},
intro1: function() {
this.player.animations.play("idle", 9, false);
},
我知道:有一个精灵有无限的动画,但当插值事件结束时,当前动画结束并开始另一个动画,完成后,精灵必须被销毁。如果新动画是另一个精灵,我想您可以使用loadTexture(): 如果要为一定数量的帧设置动画,可以执行以下操作:
player.animations.add('run', [0,1,2,3]);
player.animations.add('idle', [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
player.animations.play('run', 10, true);
var s = game.add.tween(player);
s.to({ y: 300,x:192 }, 3000, null);
s.start();
s.onComplete.add(function() {
player.animations.stop();
player.animations.play('idle', 9, false, true);
}, this);
player.animations.add('run', [0,1,2,3]);
player.animations.add('idle', [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
player.animations.play('run', 10, true);
var s = game.add.tween(player);
s.to({ y: 300,x:192 }, 3000, null);
s.start();
s.onComplete.add(function() {
player.animations.stop();
player.animations.play('idle', 9, false, true);
}, this);