Problem with Camera2D + PathFollow 2D

Godot Version

How do I code my Camera2D to follow the line i made with PathFollow2D?

It's for a 2d endless runner, but rather than have it randomly generated, i wanted to have the map pre-made, and also have the player moving with a certain degree of freedom within the camera, but always on the move, so as that whe it touches the rim of it its game over. But when i setup the path and run the game, it immediately exits.

Structure: Node2D2—>Path2D---->PathFollow2D—>Camera2D2

Script for Node2D2:

extends Node2D

var t :=0.0

func _process(delta: float) → void:
t +=delta
$Path2D/PathFollow2D.offset = t* 200.0

Thank you very much in advance! ^^

Use phantomCamera 2d. It’s a very good extension, it has the functionality you’re looking for built-in. There’s also very good docs for it.

1 Like

Thank you so much! : D I will look into it!