我无法让它工作,好像补间物体不会触发'Moved'事件?补间物体上的碰撞检测
我在屏幕上补间一个物体,并且需要检查它是否与玩家碰撞(通过键盘事件上下飞行)。它的工作原理,如果我追加对“感动”在检查的玩家,但如果玩家所以仍然屹立:-)
我需要检查时,补间对象移动,如果它击中玩家
不触发任何事件:
// astroid
Crafty.e('astroid, 2D, DOM, Color, Tween, Collision')
.attr({ x: 600, y: 550, w: 50, h: 200 })
.color('#8e44ad')
.tween({ x: -50 }, 4000)
.bind('Moved', function() {
console.log('moved');
if (this.hit('player1')) {
console.log('player hit 1');
}
})
.onHit('player', function() {
console.log('player hit 2');
});
您是否能够提供您的http://jsfiddle.net/ –
Ashish Mishra是的我是:-) http://jsfiddle.net/6RDYw/ – Jason94