如何创建流畅的动画背景SpriteKit?

时间:2016-11-03 06:53:23

标签: ios swift animation sprite-kit swift3

我正在制作游戏,我想让我的背景变得生动(房子在透视中移动,就像一个人走路一样) 所以我要做的是: 1)创建单个房子精灵 2)将其移动到屏幕中心并调整为0.1% 3)将精灵删除到场景 4)开始步骤1 重点是创造漂亮而流畅的动画。

我的问题是:当我试图在同一时间调整大小并移动精灵时,它就会消失并且什么也没发生。

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

0 个答案:

没有答案