我有這個功能SKAction重複計數:調用第二功能一旦第一功能已經完成它的使用斯威夫特
func midGroundlevelMovingSlow() {
let moveLevelImage = SKAction.moveByX(-self.frame.size.width, y: 0, duration: gameSpeed)
let replaceLevelImage = SKAction.moveByX(self.frame.size.width, y: 0, duration: 0)
let movingAndReplacingLevelImage = SKAction.repeatAction(SKAction.sequence([moveLevelImage,replaceLevelImage]), count: 5)
mgImage.runAction(movingAndReplacingLevelImage)
mgImage2.runAction(movingAndReplacingLevelImage)
}
一旦這已經完成了它的5環,我想調用這個函數:
func midGroundlevelMovingMedium() {
let moveLevelImage = SKAction.moveByX(-self.frame.size.width, y: 0, duration: gameSpeed * 2)
let replaceLevelImage = SKAction.moveByX(self.frame.size.width, y: 0, duration: 0)
let movingAndReplacingLevelImage = SKAction.repeatAction(SKAction.sequence([moveLevelImage,replaceLevelImage]), count: 5)
mgImage.runAction(movingAndReplacingLevelImage)
mgImage2.runAction(movingAndReplacingLevelImage)
}
有人可以幫我解決這個問題嗎?
感謝,
史蒂芬
是什麼類型mgImage? – Moriya
這是一個SKSprite節點。 – Fiducial13