Godot Version
4.2.2
Question
Hello all,
I have a question regarding a packed scene and how to spawn the item that came from a Udemy series on making a proper platformer. The idea is a simple one but complex for me, it makes a dust particle type effect when the player jumps in the air.
However, nothing is appearing when jump is pressed. And I need to need to track down the culprit. I have a scene that has the particle effect as an animated sprite, so, and this is the code in I have in the character scene does the following look right:
@export var jumpDust : PackedScene; #drag and drop`
in the jump function
func jump():
if is_on_floor():
velocity.y = jump_velocity;
spawn_dust(jumpDust)
print("dusty roads");
Then in the spawn function:
#new Function that will make the correct dust appear when jumping
func spawn_dust(dust_jump: PackedScene): #packed scene to drag and drop
var jump_dust = dust_jump.instantiate(); #instantiate
jump_dust.position = position; #set position to the sprite
print("hello sweetie")
#pass
Does this code look right? The prints are working
In the packed scene I have this code:
extends AnimatedSprite2D
# Called when the node enters the scene tree for the first time.
func _ready():
play();
print("ready to play");
#pass # Replace with function body.
func _on_animation_finished():
print("finished")
queue_free();
#pass # Replace with function body.
Does this also look right? “Ready to Play” and “finished” are NOT showing.
As always here is a thankyou in advance.