In my game, I want to call a function every few seconds that creates random objects from an array. I am currently moving these objects using SKAction as follows:
func createRandmoObject() { let random = arc4random_uniform(4) randomObject = randomObjects[random] randomObject.runAction(SKAction.moveTo(CGPoint(x: randomObject.position.x, y: 0 - randomObject.size.height), duration: 3)) addChild(randomObject) }
and when the object hits the player, it is deleted, then the function is called again. The problem with this method is that I found that the movement of an object is not always smooth, when the frame rate drops for some reason, sobriety occurs. Now I know how to calculate the delta time in the update method, but I'm not sure how to apply it to an object when this object continues to change, and not always on the screen, and there are some other objects like this (let them think of them as enemies , and there is another function that creates another enemy). How can I make these random objects move according to deltopathy instead of SKAction?
source share