Help with First 2D game tutorial - Mobs keep spawning after collision

Godot Version

v4.2.1.stable.official [b09f793f5]


It looks like game_over isn’t called on hit or hit isn’t emitted.

_on_body_entered is being called - the player is being hidden - but the game keeps going afterwards.

I’m not sure where the break is here. In the player script i have:

func _on_body_entered(body):
	$CollisionShape2D.set_deferred("disabled", true)

and hide() is triggering at least

You have to emit your signal in your game_over function. Without that, that function has no idea when to use the rest of its code.

1 Like

show the code who connected to this hit signal
never mind, i see you connected it via signal in inspector dock,
show what’s in your game_over function, also try to add print(“game_over”) something there to tell if it’s accessed or not

lol it’s already on the screenshots, yeah then just add the print(“game_over”) to tell if it’s accessed or not

if yes, then you will want to know if the start timer actually playing or started again to trigger back the timers

1 Like

It’s the darndest thing.

I created this post, left the house for 6 hours. Come back, test it with the print() line, and it works. LIke the game is ending normally now. It works without the print too, but like either the dough just needed to rise, or the function only started working when it was observed. Schroedinger’s game_over.

Ah well, thank you for the help!

bro, that shouldnt be happening, unknown bug ?