#Invalid set index 'flip_h' (on base 'null instance') with value of type 'bool'.
1 messages · Page 1 of 1 (latest)
onready var sprite = $Sprite isn't working. Check the name/path to $Sprite
yes "Sprite" would need to be the NAME of the object in your tree - not the TYPE of object. If you're coming from Unity this is different than how Unity does it. You can have multiple objects of type Sprite but they all need to have a unique name
ok and no i was following an guide
gotcha. Well check the name and path. they have to match. so this object must parent an object (of type sprite) that is named Sprite for it to find it.
ok so now i get "Invalid get index 'flip' (on base: 'null instance')." i change the code in question to onready var sprite = $whitemite
im assuming i might be messing it up the sprite thing still cause null means nothing and it talking about the instance
null means it can't find "whitemite" in this case
take a screen grab/snip of your Scenetree
the W in whitemite is capitol looks like
also you can just click it in your Scene tree and change the name to something else if you prefer
but you have to change the code to match - naturally
ok now i get this "Invalid get index 'flip' (on base: 'Sprite')."
it seems to be the same error just even further back
i changes the code to "onready var sprite = $Whitemite"
also it seems to only happen when i try to go to the left
$res://Whitemite.png" is not $Whitemite
"res://Whitemite.png" is actually a texture
ah ok
"res://" means it's loading the texture from your filesystem
not the object in your scene tree
so var sprite = $"res://" isn't actually a sprite - it's a texture
ok now i get an error even before i run
the line of code should be
onready var sprite = $Whitemite
honestly I don't think you even need the onready
you do
$ is an alias of get_node(), so if the node's children aren't in the tree yet (before the parent's _ready), it won't work
ah yes. I stand corrected.
ok i still get this error "Invalid get index 'flip' (on base: 'Sprite')."
flip_h yes here the other part of the code
you typed flip.h not flip_h
oh woops