Godot Version
4.6.2
Question
For the test, I have a loop to add n objects to the scene:
for i in range(0, 3):
on_laying_egg_event(EggConfig.new(Vector2(919.0+i*20, 449.0+i*20), 0, 1))
After animation, “stars” should be removed by the script:
func scale_down_and_kill() -> void:
if is_queued_for_deletion():
return
if _kill_tween and _kill_tween.is_valid():
_kill_tween.kill()
_kill_tween = create_tween()
_kill_tween.parallel().tween_property($Star, "scale", Vector2(INIT_SCALE, INIT_SCALE), TWEEN_TIME_IN_S)
_kill_tween.parallel().tween_property($Star, "rotation_degrees", 0, TWEEN_TIME_IN_S)
_kill_tween.finished.connect(queue_free, CONNECT_ONE_SHOT)
print("kill ", self)
As you can notice on the record, “kill” is always printed three times, but for some reason, “stars” are not removed.

The scale_down_and_kill method is called as a signal callback on egg animation end. The implementation of the callback:
func spawn_chick_and_free_egg(egg: Egg, star: Star) -> void:
if not is_instance_valid(star):
print("Star is not valid")
return
if not is_instance_valid(egg):
print("Egg is not valid")
star.scale_down_and_kill()
return
var animal: Node
if GameState.chick_incubation_time_in_s == 0:
animal = HenSceen.instantiate()
animal.scale = Vector2(0.15, 0.15)
else:
animal = ChickSceen.instantiate()
animal.generation = egg.generation
animal.position = egg.sprite_position
egg.visible = false
egg.queue_free()
add_object(animal)
star.scale_down_and_kill()
Any idea what I’m doing wrong? ![]()
[EDIT]
Change repo visibility (temporarily) to public
[EDIT]
Changed the repo to private