seeding-planets/entities/camera/scripts/camera.gd

12 lines
287 B
GDScript

extends Camera2D
class_name Camera
const LERP_WEIGHT = 0.9
@export var following : Node2D
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if following:
global_position = following.global_position.lerp(global_position, LERP_WEIGHT)