Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial



I have this code for a game I am learning how to make:

import SpriteKit
class GameScene: SKScene {
    override func didMoveToView(view: SKView) {
    backgroundColor = SKColor.whiteColor()
    let background = SKSpriteNode(imageNamed: "background1")
    background.position = CGPoint(x: size.width/2, y: size.height/2)
    background.anchorPoint = CGPoint(x: 0.5, y: 0.5) // default
    // background.zRotation = CGFloat(M_PI) / 8
    background.zPosition = -1

    let zombie = SKSpriteNode(imageNamed: "zombie1")
    zombie.position = CGPoint(x: 400, y: 400)
    override func update(currentTime: NSTimeInterval) {
        zombie.position = CGPoint(x: zombie.position.x + 4,
        y: zombie.position.y)

When I put in the override func update in, i get an error at the line where I use the zombie.position. The error says: "use of unresolved indentifier 'zombie'. Why does it do this?