"Invalid call. Nonexistent function ‘setup_camera’ in base ‘Camera2D’. My function is named correctly. Here’s some code, starting with the GameCamera script
extends Camera2D
var player: Player = null
func _ready():
pass
func _process(delta):
pass
func _physics_process(delta):
if player:
global_position.y = player.global_position.y
func setup_camera(_player: Player):
if _player != null:
player = _player
and then here’s my game.gd code:
extends Node2D
var camera_scene = preload(“res://scenes/game_camera.tscn”)
var camera = null
func _ready():
camera = camera_scene.instantiate()
camera.setup_camera($Player)
add_child(camera)
func _process(delta):
pass