好吧,我束手无策,我无法让 CraftyJS 进行补间。
所以我想做的是,每次蘑菇被击中时,我想检查那个蘑菇是否有“答案”组件。如果它存在,我什么也不做。否则,我想显示一个消失的大红色框。
Crafty.c("Mushroom", {
init: function() {
this.addComponent("collision");
this.collision();
this.onhit("bullet",function(e) {
this.destroy();
e[0].obj.destroy();
if(!this.has("Answer")) {
Crafty.e("2D, Tween, color, canvas")
.attr({alpha: 1.0, x: 170, y: 100, w:300, h:100})
.color("red")
.bind("enterframe", function() { //How do i actually get the box to fade?
this.tween({alpha: 0.5, x: 170, y: 100}, 30);
});
}
});
}