Is it possible to emit the shoot signal on a certain frame of animation? I made a 20-odd frame animation of a minigun spooling up, shooting, then spooling down and I just want to time a burst in the middle. I'm new and pulled an example from this link: https://www.reddit.com/r/godot/comments/aa7jff/how_do_you_play_a_sound_on_a_specific_frame_in_an/ about how to make something happen on an individual frame.
I'm getting the error "expected block in pattern branch" on the emit line at the bottom.
func _on_GunTimer_timeout():
$AnimatedSprite.play("firing")
$AnimatedSprite.connect("frame_changed", self, "on_firing_frame")
$AnimatedSprite.connect("animation_finished", self, "_on_firing_animation_finished")
# emit_signal('shoot', Bullet, $Position2D.global_position)
$GunTimer.start()
func _on_firing_animation_finished():
$AnimatedSprite.play("default")
func on_firing_frame():
match frame:
9, 11, 13, 15:
emit_signal('shoot', Bullet, $Position2D.global_position)