I Want to make a game where you move player left and right by moving your mouse left and right. Like this
Does anybody know how to write code in C# which allows you to move the player using the mouse?
Untested but something like that I guess: (in your player script)
public override void _Process(float delta) { Position = new Vector2(GetViewport().GetMousePosition().x, Position.y); }
You probably want the mouse delta (the difference in position from frame to frame). So check the mouse position minus the last mouse position, do your movement, then set the last mouse position to the current mouse position.