I've been playing with Godot for about a week. I'm trying to expand on the Your First Game example with the squids. Here's my goal...
- fish spawns
- player eats the fish
- fish changes to a skeleton animation and falls off the scene via gravity
So far all works great except I can't get the signal to fire again until the dead fish falls off the screen (and is queue_free'd), like if two fish spawn at the same time only the first fish the player touches will work.
Here's my code...
func _on_FishSpawner_timeout() -> void:
var fish = load("res://Fish.tscn").instance()
func _on_Player_eat() -> void:
$Fish.gravity_scale = 10
func _on_Player_body_entered(body: Node) -> void:
if body.name == "Fish":
So, the fish spawns every X seconds thanks to the Timer. The player touches the fish. The fish animation changes to the "dead" set and gravity is applied to make it fall off the screen. When the fish gets off the screen it frees up.
All this works fine...for a single fish. If I try to touch two+ fish with the player before the initially touched fish falls off the screen nothing happens, not even the print command.
How can my hungry squid gobble up multiple fish at once?