My character keeps on randomly dying in the tutorial Dodge the Creeps game, what could be the bug?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By awu2541

I completely finished the Dodge the Creeps game in the making your first 2d game tutorial. However there is a bug where the player randomly dies without touching any mobs and this occurs at inconsistent times. The game over message appears and the game resets and runs normally otherwise including the collisions. The longest I’ve gone is 25 seconds and then it randomly triggers game_over. I’m not sure where is the bug.

Can we see your code?

rguerreiro | 2022-08-24 22:39

I wonder if you have some misaligned or misplaced collision shapes. To check:

  • From the Godot editor’s main menu…
  • Activate Debug | Visible Collision Shapes

That’ll draw the collision shapes in-game. Do you see some that do not coincide with the character sprites?

jgodfrey | 2022-08-24 14:25

I figured it out. The code basically came directly from the tutorial so there was something wrong with the setup of one of the mob node. There was an extra animation like jgodfrey mentioned. It was a default animation so there were invisible enemies that were created that were floating around. I deleted the extra animation and now it runs just fine. Thank you everyone.

awu2541 | 2022-08-27 04:40