1
我有它創建了一個CCSprite然後在屏幕上移動它的功能:CCActionSequence/CCActionDelay不延遲每個動作?
func fireWeapon(target: CGPoint) {
let projectile = CCBReader.load("Projectile") as! CCSprite
projectile.position = player.position;
self.addChild(projectile);
let moveAction = CCActionMoveTo(duration: 1, position: target);
let delayAction = CCActionDelay(duration: 1);
let removeAction = CCActionCallBlock(projectile.removeFromParentAndCleanup(true));
projectile.runAction(CCActionSequence(array: [moveAction, delayAction, removeAction]));
}
我試圖清理精靈,他們通過序列與移動操作運行removeFromParentAndCleanup()完成自己的運動動作之後。然而,每一個動作都是按照順序依次觸發,沒有任何延遲。精靈在創建後立即被清理乾淨。爲什麼不延誤工作?我嘗試過並且沒有CCDelay操作,並且得到了相同的結果。