I dragged a folder named "movementAnim" into the Image assets folder, which is suppose to create a texture atlas (from what I picked from the WWDC 2015 What's New in SpriteKit Session). See the code below:
SimpleSprite class:
Init() {
let spriteAtlas = SKTextureAtlas(named: "movementAnim")
sprite = SKSpriteNode(texture: spriteAtlas.textureNamed("moveAnim01"))
sprite.name = spriteCategoryName
sprite.position = CGPointMake(CGRectGetMidX(screenSize), sprite.frame.size.height * 3.7)
initialPos = sprite.position
sprite.zPosition = 10
}
func physicsProperties () {
sprite.physicsBody = SKPhysicsBody(rectangleOfSize: sprite.frame.size)
sprite.physicsBody?.friction = 0.4
sprite.physicsBody?.restitution = 0.1
sprite.physicsBody?.dynamic = false
}
In the init of the GameScene class:
simpleSprite = SimpleSprite()
addChild(simpleSprite!.sprite)
simpleSprite!.physicsProperties()
I get the following log message:
Texture Atlas 'movementAnim' cannot be found.
But when I use the following instead of the texture, it works perfectly:
sprite = SKSpriteNode(imageNamed: "newMoveAnim01")
I've crossed checked the names and made sure there are no duplicates. I am not sure what's wrong.
If you add the extension .spriteatlas to your folder name, it should work. XCode does not add this by default.
You are correct that atlases are done in the image assets folder now, William Hu's way was the old way it was done.