I need help with my code

Godot 4.4
I cant seem to figure out why but my character in my game worked and everything did until I tried to add a projectile for him to shoot. Now the games broken somehow and I cant load in without a reference to the CharacterBody2D saying trying to assign window to character body 2d something along those lines. i don’t want to give up on this so I hope I can get as much help as I can




Hi,

I’m not sure I fully understand the issue.

[…] saying trying to assign window to character body 2d something along those lines

Can you share the actual error you’re having when playing?

1 Like

The error you’re having (should be Trying to assign value of type ‘Window’ to variable of type ‘CharacterBody2D’) is because you are trying to assign the node at the path “..” to your variable. $“..” returns the window because that’s what’s at the root of the scene tree. To assign the correct node to the variable, you need to actually specify its path (e.g. $CharacterBody2D if it’s a direct child of the node the script is on)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.