#New guy needing help

46 messages · Page 1 of 1 (latest)

lime maple
#

so I been following some YouTube videos since this is my first time trying to code or develop anything. I'm stuck at a certain part where I'm trying to get and apple to fall from a tree. I created 2 animations. the original fall, and a fade. when I type the code in, and run the game, as soon as i click the tree it crashes my game prompting this code.

E 0:00:04:0850 apple_collectible.gd:9 @ fallfromtree(): Node not found: "AnimationPlayer" (relative to "/root/world/apple_collectible").
<C++ Error> Method/function failed. Returning: nullptr
<C++ Source> scene/main/node.cpp:1638 @ get_node()
<Stack Trace> apple_collectible.gd:9 @ fallfromtree()
apple_collectible.gd:6 @ _ready()
apple_tree.gd:39 @ drop_apple()
apple_tree.gd:19 @ _process()

I've followed everything to the video to this point and of course the video works and mine doesn't lol.

This is what my code is.

func _ready():
fallfromtree()

func fallfromtree():
$AnimationPlayer.play("fallingfromtree")
await get_tree().create_timer(1.5).timeout
$AnimationPlayer.play("fade")
print("+1 apples")
await get_tree().create_timer(0.3).timeout
queue_free()

Any help will be greatly appreciated!

buoyant gorge
#

Without seeing your scene tree and the video, all we can say is that your scene tree is wrong as it doesn't include the AnimationPlayer node as a child of the node using that script.

ocean thorn
lime maple
#

@ocean thorn where would i locate that

ocean thorn
#

Show left side of the editor

#

@lime maple

lime maple
ocean thorn
#

Ok so the $animationplayer path to the node is wrong becuz it's inside the sprite

#

Use $AnimatedSprite2D/AnimationPlayer instead

#

Perfect timing for coming back

lime maple
#

i just tried that and still got the same response =/

ocean thorn
#

Show me
And use print screen key and ctrl v into discord
That will look much better

#

R u there @lime maple

lime maple
#

yeah 1 sec

ocean thorn
#

Ok

lime maple
ocean thorn
#

It's not the same error
U forgot the /AnimationPlayer for the end of the
$Animatedsprite2d/AnimationPlayer

lime maple
#

ah ok let me try

ocean thorn
#

It refers to the sprite now not the animationplayer

#

It's like windows folder path
But with forward slash

#

And a $ at the beginning

lime maple
ocean thorn
#

Can you do somethin like put a $ in the middle of the code and show what the autocorrect shows

#

It should show a $animsprite/animplayer
I did shorten these thing so it will be it's long names

lime maple
#

ok now where exactly in the middle would i put it i apologize its literally my first real day doing any of this lol

ocean thorn
#

Somewhere in a function
And then delete it after u put it there
Just wait until autocorrect shows up

lime maple
ocean thorn
#

Ok im not a good help lol

#

Makethe $ have its own line

#

I didnt meant to exactly the middle of the code
Just somewhere where autocorrect can show up

#

Like this
Func randomstuff():
Code.rutjfskcf
Await djfjse
$

#

Dont try ctrl c ctrl v ing

#

I will end up downloading godot 4 for phone just to help fixing this

lime maple
random juniper
#

you have AnimationSprite2D in your code, the node is called AnimatedSprite2D

lime maple
#

ok thank you i really appreciate the help hopefully i wont be a bother much longer

#

ah smh attention to detail im slipping lol

ocean thorn
lime maple
#

yes that did fix it

random juniper
ocean thorn
#

Bruh

ocean thorn
lime maple
#

lol naw without the steps they wouldnt have been able to see where we was missing!

ocean thorn
#

Is this code from a tutorial