#broke my game help please
14 messages · Page 1 of 1 (latest)
same error XD
Seems like player is null. The errors would probably tell you something about "node not found".
The reason is that you have a wrong reference to the player in the scene tree.
It was @onready var player = get_node("/root/Game/Player") in the tutorial.
In your case
@onready var player = $Player
is the same as
@onready var player = get_node("/root/Game/slimemob/Player")
So it looks for player as a child of the slime.
Unique name with "%" only works if the slime is already in the same scene as the player (https://docs.godotengine.org/en/stable/tutorials/scripting/scene_unique_nodes.html#same-scene-limitation)
hmmmm thats really odd then
just tested the @onready var player = get_node("/root/Game/Player" incase this is the errors
I see your node is lower case game.
@onready var player = get_node("/root/game/Player")
yes
ok so i did try that before and it didnt work however i copy and pasted it from you and it did work not sure how but thank you so much i put way to much effort into this game XD
Ye no problem!
You gotta be careful with relative paths of nodes and also with the names of nodes since everything is case sensitive.
yeah scared cause ill make a second stage soon will probably break again XD
As long as the path won't change it's fine. You could also add the player to a "player" group and use var player = get_tree().get_nodes_in_group("player") to get the player in case the path should change.