     
         }
         
+        // Moving Road [Kevin/Tina, updated by Vincent]
         self.enumerateChildNodesWithName("road", usingBlock: { (node, stop) -> Void in
             if let road = node as? SKSpriteNode {
                 road.position = CGPoint(x: road.position.x-self.roadSpeed, y: road.position.y)
-                
                 if road.position.x <= -road.size.width {
                     road.position = CGPoint(x: road.position.x+road.size.width * 2, y: road.position.y)
                 }
+                
+                
+                if self.jumpMode == true {
+                    self.currentTime = currentTime
+                    self.deltaTime = self.currentTime - self.previousTime
+                    self.previousTime = currentTime
+                    self.jumpTime = self.jumpTime + self.deltaTime
+                }
+            }
+        })
+        
+        // Moving Obstacles [Brian/Kori]
+        self.enumerateChildNodesWithName("trashCan", usingBlock: { (node, stop) -> Void in
+            if let trash = node as? SKSpriteNode {
+                trash.position = CGPoint(x: trash.position.x-self.roadSpeed, y: trash.position.y)
+                if trash.position.x < 0 {
+                    trash.removeFromParent()
+                }
             }
         })
       
-      
-      //kori and brian
-      
-      self.enumerateChildNodesWithName("trashCan", usingBlock: { (node, stop) -> Void in
-        if let trash = node as? SKSpriteNode {
-          trash.position = CGPoint(x: trash.position.x-self.roadSpeed, y: trash.position.y)
-          if trash.position.x < 0 {
-            trash.removeFromParent()
-            
-          }
-        }
-        
-      })
-      
-      self.enumerateChildNodesWithName("bench", usingBlock: { (node, stop) -> Void in
-        if let craneHook = node as? SKSpriteNode {
-          craneHook.position = CGPoint(x: craneHook.position.x - (self.roadSpeed), y: craneHook.position.y)
-          if craneHook.position.x < 0 {
-            craneHook.removeFromParent()
-            
-          }
-        }
-        
-      })
-
-
-      self.enumerateChildNodesWithName("craneHook", usingBlock: { (node, stop) -> Void in
-        if let craneHook = node as? SKSpriteNode {
-          craneHook.position = CGPoint(x: craneHook.position.x - (self.roadSpeed/2), y: craneHook.position.y)
-          if craneHook.position.x < 0 {
-            craneHook.removeFromParent()
-            
-          }
-        }
-        
-      })
-
-      
-      //Kevin-Tina/ Moving background
-      self.enumerateChildNodesWithName("background", usingBlock: { (node, stop) -> Void in
-          if let bg = node as? SKSpriteNode {
-              bg.position = CGPoint(x: bg.position.x-self.backgroundSpeed, y: bg.position.y)
-              if bg.position.x <= -bg.size.width {
-                  bg.position = CGPoint(x: bg.position.x+bg.size.width * 2, y: bg.position.y)
-              }
-          }
-          
-      })
-    
-      
-      //Kevin-Tina/ Moving road
-      self.enumerateChildNodesWithName("road", usingBlock: { (node, stop) -> Void in
-        if let road = node as? SKSpriteNode {
-          road.position = CGPoint(x: road.position.x-self.roadSpeed, y: road.position.y)
-          if road.position.x <= -road.size.width {
-            road.position = CGPoint(x: road.position.x+road.size.width * 2, y: road.position.y)
-          }
-          
-        
-          if self.jumpMode == true {
-              self.currentTime = currentTime
-              self.deltaTime = self.currentTime - self.previousTime
-              self.previousTime = currentTime
-              self.jumpTime = self.jumpTime + self.deltaTime
-          }
-        }
-     })
-  }
+        self.enumerateChildNodesWithName("bench", usingBlock: { (node, stop) -> Void in
+            if let craneHook = node as? SKSpriteNode {
+                craneHook.position = CGPoint(x: craneHook.position.x - (self.roadSpeed), y: craneHook.position.y)
+                if craneHook.position.x < 0 {
+                    craneHook.removeFromParent()
+                }
+            }
+        })
+
+        self.enumerateChildNodesWithName("craneHook", usingBlock: { (node, stop) -> Void in
+            if let craneHook = node as? SKSpriteNode {
+                craneHook.position = CGPoint(x: craneHook.position.x - (self.roadSpeed/2), y: craneHook.position.y)
+                if craneHook.position.x < 0 {
+                    craneHook.removeFromParent()
+                }
+            }
+        })
+        
+    }
     
     // MARK: - HERO ACTIONS
     // [Tuan/Vincent]

            //         Jump Limit Logic ------ Uncomment to use.
            if self.jumpNumber < 2 && self.jumpTime <= 0.5 {
                self.hero.physicsBody!.velocity = CGVectorMake(0, 0)
                self.hero.physicsBody!.applyImpulse(CGVectorMake(0, 35))
                self.jumpNumber += 1
            }
        }
        else if self.duckMode == true {
            let originalHeight = hero.frame.height * 2
            let stand = SKAction.resizeToHeight(originalHeight, duration: 0.5)
            self.hero.runAction(stand)

            self.jumpNumber = 0
        case UInt32(self.heroCategory) | UInt32(self.obstacleCategory):
            println("Hero hit obstacle")
        default:
            println("Trash hit...obstacle?")
        }
    }
    
    // MARK: - OBSTACLES
    // [Brian/Kori]
    
    func spawnBench(){
        var randX: Float = Float(arc4random_uniform(300) + 1)
        //var anotherFloat: Float = Float(randX)
        
        let bench = SKSpriteNode(imageNamed: "bench")
        
        bench.position = CGPointMake(CGRectGetMaxX(self.frame), 75)
        bench.size = CGSize(width: 105, height: 30)
        bench.physicsBody = SKPhysicsBody(rectangleOfSize: CGSize(width: 105, height: 30))
        bench.physicsBody?.dynamic = false
        bench.physicsBody?.categoryBitMask = UInt32(self.obstacleCategory)
        bench.physicsBody?.contactTestBitMask = UInt32(self.heroCategory) | UInt32(self.obstacleCategory)
        bench.physicsBody?.node?.name = "bench"
        bench.zPosition = 0
        bench.name = "bench"
        self.addChild(bench)
    }
    
    func spawnCrane(){
        var randX = arc4random_uniform(300) + 100
        let craneHook = SKSpriteNode(imageNamed: "crane.gif")
        
        craneHook.anchorPoint = CGPointMake(1.0, 1.0)
        craneHook.position = CGPointMake(CGRectGetMaxX(self.frame) + CGFloat(randX),
            CGRectGetMaxY(self.frame))
        craneHook.physicsBody = SKPhysicsBody(rectangleOfSize: CGSize(width: 60, height: 100))
        craneHook.physicsBody?.dynamic = false
        craneHook.size = CGSize(width: 60.0, height: 100.0)
        craneHook.name = "craneHook"
        self.addChild(craneHook)
    }
    
    
    func spawnTrashcan(){
        var randX: Float = Float(arc4random_uniform(500) + 100)
        //var anotherFloat: Float = Float(randX)
        
        //    let trashCan = SKSpriteNode(imageNamed: "trashCan.gif")
        let trashCan = SKSpriteNode(imageNamed: "trashCan.gif")
        
        trashCan.position = CGPointMake(CGRectGetMaxX(self.frame) + CGFloat(randX), 75)
        trashCan.size = CGSize(width: 35, height: 40)
        trashCan.physicsBody = SKPhysicsBody(rectangleOfSize: CGSize(width: 35, height: 40))
        trashCan.physicsBody?.dynamic = false
        trashCan.physicsBody?.categoryBitMask = UInt32(self.obstacleCategory)
        trashCan.physicsBody?.contactTestBitMask = UInt32(self.heroCategory) | UInt32(self.obstacleCategory)
        trashCan.physicsBody?.node?.name = "trashCan"
        trashCan.zPosition = 12
        trashCan.name = "trashCan"
        addChild(trashCan)
    }
  
}

