Reputation: 3
I have started my Godot learning from this tutorial.
Right now I am only at the beginning of the tutorial, but I already struggling. I need somehow focus my camera on the "bird". But the command that is used from the tutorial gives me an error. I know this tutorial is outdated, but can i somehow focus my camera on the object in Godot(is there a specific command or function maybe)? This does not sound too complicated to implement. code, node
extends Camera2D
var bird
func _ready():
bird = get_tree().get_root().get_child(0).get_node("bird")
pass
func _physics_process(delta):
set_position(Vector2(bird.get.position().x, get_position().y))
Upvotes: 0
Views: 1253
Reputation: 39
Nice for trying Godot!
In _physics_process
you're attempting to reference a member of bird
called get
which does not exist.
Simply replace the .
with _
to reference the get_position()
method.
Final line should look like this:
set_position(Vector2(bird.get_position().x, get_position().y))
Upvotes: 0