快速获取SKAction.repeat的循环索引

时间:2018-12-05 14:05:10

标签: ios swift loops sprite-kit

我正在寻找一种获取SKAction.repeat循环的循环索引的方法。

在下面的代码中,我想用重复的索引替换'LOOP_INDEX'。

这有可能吗?

node.run(SKAction.sequence([
    SKAction.run { node.physicsBody?.affectedByGravity = false },
// HERE
    SKAction.repeat(SKAction.moveBy(x: 0, y: jumpHeight / CGFloat(sequences), duration: sequenceTimes[LOOP_INDEX]), count: sequences - 1),
    SKAction.run { node.physicsBody?.affectedByGravity = true },
    SKAction.moveBy(x: 0, y: jumpHeight / CGFloat(sequences), duration: sequenceTimes[2]),
]), withKey: "jump")

感谢您的回答;)

0 个答案:

没有答案