def limit(self, mag):
    d = Math.sqrt(((self.x * self.x) + (self.y * self.y)))
    if ((d == 0) or (mag == 0)):
        return
    if (d > mag):
        self.x = ((mag * self.x) / d)
        self.y = ((mag * self.y) / d)
    return self
def limit(self, mag):
    d = Math.sqrt(((self.x * self.x) + (self.y * self.y)))
    if ((d == 0) or (mag == 0)):
        return
    if (d > mag):
        self.x = ((mag * self.x) / d)
        self.y = ((mag * self.y) / d)
    return self