Godot - Make camera follow player
Code example to make camera follow player in GDScript.
Create a new camera with Camera2D.new()
.
By using add_child()
to place it as a child node of the player, the camera will follow its parent node.
To make the camera follow the player, position the camera node in the player node.
var camera = Camera2D.new()
func _ready():
add_child(camera)