How can i set my movable camera speed?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By daniel500013

Hi i made script to make camera movable by mouse wheel but when i tried move camera by my middle mouse button camera move out of main scene so here is my question how can i set my camera speed? Under i give my simple script

bool move

public void MoveCamera(InputEventMouseButton eventMouseButton, InputEvent @event)
{
    if (eventMouseButton.ButtonIndex == (int)ButtonList.Middle && @event.IsPressed())
    {
        move = true;
        mouse = GetLocalMousePosition();
    }
    else
    {
        move = false;
    }
}

public void MoveCamera()
{
    if (move)
    {
        GlobalPosition = (GlobalPosition + mouse);
    }
}

public override void _Process(float delta)
{
    MoveCamera();
}
:bust_in_silhouette: Reply From: Magso

Create a new float variable for the speed.

[Export]
float speed;

public void MoveCamera()
{
    if (move)
    {
        GlobalPosition += mouse*speed;
    }
}