#broke my game help please

14 messages · Page 1 of 1 (latest)

plain ginkgo
#

try direction.x/y

tight kernel
#

same error XD

last stream
#

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.

tight kernel
#

oh yeah i changed it originaly

#

to a unique namea and it ran fine before

last stream
tight kernel
#

hmmmm thats really odd then

#

just tested the @onready var player = get_node("/root/Game/Player" incase this is the errors

last stream
#

I see your node is lower case game.
@onready var player = get_node("/root/game/Player")

tight kernel
#

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

last stream
#

Ye no problem!
You gotta be careful with relative paths of nodes and also with the names of nodes since everything is case sensitive.

tight kernel
#

yeah scared cause ill make a second stage soon will probably break again XD

last stream
#

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.