Welcome to the forums @gswee!
Looking at the code, I think there are two issues going on. The first is that the animation in _physics_process is overriding the collision animation before it has a chance to play. The second is because you are setting the velocity on the x axis in physics process, setting it to zero in _on_Fireball_body_entered won't stop it from moving, as it will be instantly overridden in the _physics_process function.
However, you should be able to fix both issues by changing _physics_proces, _on_Fireball_body_entered and on_timeout_complete to the following (untested):
# We need a variable to tell if we have collided or not:
var collided = false
func _physics_process(delta):
# if we have NOT collided, then move and play the default animation
if (collided == false):
velocity.x = SPEED * delta * direction
translate(velocity)
$AnimatedSprite.play("default")
func _on_Fireball_body_entered(body: PhysicsBody2D) -> void:
# check if collided is already equal to true, so we do not reset the timer every
# time something collides with the fireball
if (collided == true):
return
$CollisionShape2D.disabled = true
# set collided to true, so the fireball stops moving
collided = true
# # CONNECT TIMER
timer.connect("timeout",self,"on_timeout_complete")
add_child(timer)
$AnimatedSprite.play("collide")
func on_timeout_complete():
print("bullet stopped colliding") # test
queue_free()