Hi,
I'm new in Godot and have a problem that I can't solve. I have a project where player 1 or player 2 play the same level not at the same time. So, in order to do that, I instanced my Player 1 or Player 2 scene to my level 1 (named "world2). It works, but know, my camera script that make follow the player only on the x axis doesn't work anymore, because the camera is unable to find the node Player 1 or Player 2 (I get a null instance).
The scripts in my world scene look like that (for player2):
extends Node2D
onready var player2 = ("Root/world2/Player2")
func _ready():
var Player2 = preload("res://Scènes/Player2.tscn").instance()
add_child(Player2)
And the script of my camera 2D (was working before with the node player2 as a child of the world):
extends Camera2D
onready var player2 = get_node ("Player2")
func _process (delta):
position.x = player2.position.x
I try to write also the absolute path of Player 2 but without success... Sorry if it's a basic question but I can't figure out =/...