【发布时间】:2018-05-14 03:40:30
【问题描述】:
我使用移相器 2.6.1。
我创建了一个动画。这工作正常,但有时动画没有开始。我不知道为什么。
在create() 函数中,我为我的精灵表添加动画:
this.car = game.add.sprite(game.world.centerX,500, 'car');
this.car.animations.add('mover',[0,1,2,3],1000, true);
this.car.fixedToCamera = true;
当重叠时,我启动函数来动画:
game.physics.arcade.overlap(this.car, this.borders, this.canMove, null, this);
这是我的功能:
},canMove: function(car, objet){
if(crash == 0){
crash = 1;
_this.car.animations.play("mover");
console.log("fire")
setTimeout(function(){
_this.car.animations.stop();
_this.car.frame = 0;
crash = 0;
},1000)
}
}
当汽车与边界重叠时,触发此功能。
console.log() 被触发,但动画突然没有开始。我可以重新启动我的页面很多时间,但即使触发了console.log(),动画也没有开始。
【问题讨论】:
-
你能贴出你的代码sn-p吗?
-
在这里发布你的全部代码
-
好的,我已经添加了所有代码
-
动画在“canMove”功能上开始
-
我的其他代码已经有这个问题了
标签: javascript jquery phaser-framework