         var result = input
         if(input.x > self.frame.width)
         {
-            result.x = 0
+            let exceedLength:CGFloat = input.x - self.frame.width
+            result.x = exceedLength
         }
         else if(input.x < 0)
         {
-            result.x = self.frame.width - 1
+            let exceedLength:CGFloat = 0 - input.x
+            result.x = self.frame.width - exceedLength
         }
         
         if(input.y > self.frame.height)
         {
-            result.y = 0
+            let exceedLength:CGFloat = input.y - self.frame.height
+            result.y = exceedLength
         }
         else if(input.y < 0)
         {
-            result.y = self.frame.height
+            let exceedLength:CGFloat = 0 - input.y
+            result.y = self.frame.height - exceedLength
         }
         return result
     }

    static let SnackHeadCategoryName = "SnackHead"
    static let SnackBodyCategoryName = "SnackBody"
    static let FoodCategoryName = "Food"
  
    static let SnackHeadCategory   : UInt32 = 0x1 << 0
    static let SnackBodyCategory : UInt32 = 0x1 << 1
    static let FoodCategory  : UInt32 = 0x1 << 2

        self.path = CGPath(rect: rect, transform: nil)
        PixelSize = size
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
