extends Camera2D var is_controlling_camera: bool = false var is_dragging: bool = false func _input(event: InputEvent) -> void: if event.is_action_pressed("camera_engage"): is_controlling_camera = true elif event.is_action_released("camera_engage"): is_controlling_camera = false return if !is_controlling_camera: return if event.is_action_pressed("camera_drag"): Input.mouse_mode = Input.MOUSE_MODE_CAPTURED is_dragging = true elif event.is_action_released("camera_drag"): Input.mouse_mode = Input.MOUSE_MODE_VISIBLE is_dragging = false if event.is_action_pressed("zoom_in"): zoom *= Vector2(1.25, 1.25) elif event.is_action_pressed("zoom_out"): zoom *= Vector2(0.75, 0.75) if is_dragging: if event is InputEventMouseMotion: position = lerp(position, event.screen_velocity, 0.01)