简体   繁体   中英

Spawning Sprite problems in swift3 xCode

Im having some issues, I have sprites spawn on the right of the screen and work there way left then when they go off the screen they are removed from the scene and the process restarts. I want every spawn to get quicker by like 0.1seconds.

Problem is i am calling my spawn function when the game starts and its on a constant loop so i cant then update the delay.

Spawn Code:

    func spawnBirdRL() {                                                    
    let spawn = SKAction.run({ () -> Void in
        self.createEnemyBird()
    })
    let delay = SKAction.wait(forDuration: (TimeInterval(spawnDuration)))
    let sequence = SKAction.sequence([spawn, delay])


    self.run(SKAction.repeatForever(sequence), withKey: "Spawn")
}

Which is being called in the TouchesBegan function.

It creates the enemy bird and runs the movement loop over and over

我已通过更多信息对问题进行了轻微更改...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM