I am following along with this tutorial, and have hit a bug that I am having difficulty understanding. I've created an enemy slime character, and am adding a hurtbox on top for when the playable character jumps on it. However, the enemies squashed themselves for no apparent reason. Using print statements, I saw that they were actually squashing themselves. Not understanding how this works, I slowed down the game speed using Engine.time_scale
to see how this was happening frame-by-frame. At very slow speeds, the self-squash didn't happen, but when one of the slimes picked up more speed it squashed itself.
I have no clue why this is happening. I've set the collision layer of both the hurtbox and the "floor checking" collision box to the same value, which I've named "enemy". But I've turned off the "enemy" collision mask on the hurtbox. If I turn off the "enemy" collision layer on the hurtbox, then everything works as expected. How is it able to collide with itself, even with "enemy" not selected as a collision mask? And why is this seemingly affected by the speed at which the enemies move?
I know this is a bit complicated, so I've uploaded a couple of short videos to demonstrate what I mean.
pt 1
pt 2
I've also uploaded my project to GitHub, if it'd be helpful to poke around.