I want to Create a endless scrolling background for my spritekit game, iT should consist of one or two images probably, which repeat themselves? I found these one and two exampl
func backgroudScrollUpdate(){
BG .position = CGPoint(x: BG.position.x - 5, y: BG.position.y)
BG2.position = CGPoint(x: BG2.position.x - 5, y: BG2.position.y)
if BG2.position.x <= -self.frame.size.width {
BG.position = CGPoint(x: self.frame.size.width, y: 0)
}
if BG.position.x <= -self.frame.size.width {
BG2.position = CGPoint(x: self.frame.size.width, y: 0)
}
}
-UPDATED FOR SWIFT 3.1-
this is what I always use to make it work for the Y axis just switch all the extra stuff in the X positions to the Y positions