from sprite.PositionScale import PositionScale def transform_screen_to_world(convert_position: tuple, screen_transform: PositionScale): screen_scale = screen_transform.scale screen_position = screen_transform.position object_position = (convert_position[0] / screen_scale[0] - screen_position[0], convert_position[1] / screen_scale[1] - screen_position[1]) return object_position def transform_world_to_screen(convert_position: tuple, screen_transform: PositionScale): screen_scale = screen_transform.scale screen_position = screen_transform.position object_position = (int((convert_position[0] + screen_position[0]) * screen_scale[0]), (int(convert_position[1] + screen_position[1]) * screen_scale[1])) return object_position