def calc_move(self): if not hasattr(self, "vpoint"): return False x, y = mouse.position() """ # If the difference between the new point and the last point is less than the threshold: if -self.threshold < self.point.rel_diff.x < self.threshold or -self.threshold < self.point.rel_diff.y < self.threshold: self.same_location_count+=1 # If the point has been in the same location for more than 5 frames: if self.same_location_count > 5: mouse.move(x,y) # Leave the mouse in the same location return False """ par = ["width", "height"] new_x, new_y = [ (float(poss) / self.vscreen[par[i]]) * env.screen[par[i]] for i, poss in enumerate([(self.vscreen["width"] / 2) - (self.center["x"] - self.vpoint["x"]), (self.vscreen["height"] / 2) - (self.center["y"] - self.vpoint["y"])]) ] mouse.move(new_x, new_y)
def calc_move(self): if not hasattr(self, "vpoint"): return False x, y = mouse.position() par = ["width", "height"] new_x, new_y = [ (float(poss)/self.vscreen[par[i]])*env.screen[par[i]] for i,poss in enumerate([ (self.vscreen["width"]/2) - ( self.center["x"] - self.vpoint["x"]), (self.vscreen["height"]/2) - ( self.center["y"] - self.vpoint["y"] ) ])] mouse.move( new_x, new_y)
def calc_move(self): if not hasattr(self, "vpoint"): return False x, y = mouse.position() par = ["width", "height"] new_x, new_y = [ (float(poss) / self.vscreen[par[i]]) * env.screen[par[i]] for i, poss in enumerate([(self.vscreen["width"] / 2) - (self.center["x"] - self.vpoint["x"]), (self.vscreen["height"] / 2) - (self.center["y"] - self.vpoint["y"])]) ] mouse.move(new_x, new_y)
def calc_move(self): if not hasattr(self, "vpoint"): return False x, y = mouse.position() par = ["width", "height"] if self.vpoint["x"] > (self.safe_area["x"] + 20): x = x + abs((self.safe_area["x"] + 20) - self.vpoint["x"]) elif self.vpoint["x"] < self.safe_area["x"]: x = x - abs((self.safe_area["x"]) - self.vpoint["x"]) if self.vpoint["y"] > (self.safe_area["y"] + 20): y = y + abs((self.safe_area["y"] + 20) - self.vpoint["y"]) elif self.vpoint["y"] < self.safe_area["y"]: y = y - abs((self.safe_area["y"]) - self.vpoint["y"]) mouse.move(x, y)
def calc_move(self): if not hasattr(self, "vpoint"): return False x, y = mouse.position() par = ["width", "height"] if self.vpoint["x"] > (self.safe_area["x"] + 20): x = x + abs((self.safe_area["x"] + 20) - self.vpoint["x"]) elif self.vpoint["x"] < self.safe_area["x"]: x = x - abs((self.safe_area["x"]) - self.vpoint["x"]) if self.vpoint["y"] > (self.safe_area["y"] + 20): y = y + abs((self.safe_area["y"] + 20) - self.vpoint["y"]) elif self.vpoint["y"] < self.safe_area["y"]: y = y - abs((self.safe_area["y"]) - self.vpoint["y"]) mouse.move( x, y)
def calc_move(self): if not hasattr(self, "vpoint"): return False x, y = mouse.position() """ # If the difference between the new point and the last point is less than the threshold: if -self.threshold < self.point.rel_diff.x < self.threshold or -self.threshold < self.point.rel_diff.y < self.threshold: self.same_location_count+=1 # If the point has been in the same location for more than 5 frames: if self.same_location_count > 5: mouse.move(x,y) # Leave the mouse in the same location return False """ par = ["width", "height"] new_x, new_y = [ (float(poss)/self.vscreen[par[i]])*env.screen[par[i]] for i,poss in enumerate([ (self.vscreen["width"]/2) - ( self.center["x"] - self.vpoint["x"]), (self.vscreen["height"]/2) - ( self.center["y"] - self.vpoint["y"] ) ])] mouse.move( new_x, new_y)