0

I'm making a game, and I want to make my background be animated (houses moving in perspective, like a person is walking) So what I'm trying to do is: 1) Create single house sprite 2) Move it to the center of the screen and resize to 0.1% 3) Delete sprite to scene 4) Start step 1 The whole point is to create nice and smooth animation.

My problem is: when I'm trying to resize and move sprite in the same time, it just disappears and nothing happening.

class GameScene: SKScene, SKPhysicsContactDelegate {
var background = SKSpriteNode(imageNamed: "background.png")

var house1Left = SKSpriteNode(imageNamed: "House1Left.png")

override func didMove(to view: SKView) {
    self.anchorPoint = CGPoint(x: 0.5, y: 0.5)

    addChild(background)

    house1Left.position = CGPoint(x: -self.frame.size.width/2, y: 0)

    addChild(house1Left)


    let move = SKAction.moveTo(x: 0.0, duration: 1.0)
    let ressize = SKAction.scale(by: 0.1, duration: 1.0)

    house1Left.run(move)
    house1Left.run(ressize)
}

}

That is how my whole scene supposed to look

That is my single sprite I'm trying to move and resize

Petr
  • 1

0 Answers0