All Enemies are detecting Player at start of level

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

Hi,

I’m new to Godot and have been working on my first platform game.

After designating layers for collision, all my enemies are detecting player perfectly when Player is in contact with them, but for some reason at the start of the level, all the enemies detect Player immediately, even though Player is nowhere near any of them.

Is there anything I’m maybe missing or doing wrong?

Thanks guys!

Do you place the enemies at the origin when spawning them?

exuin | 2021-06-06 17:37

Thanks for the reply.

All enemies are placed at their own starting point, some further down in the level. If I add another enemy anywhere on the map, they would also detect the player at the beginning. This is affecting my player damage and the game is unable to run due to this, unless I put damage off

kyle_zyster | 2021-06-07 07:35

Is there any code for spawning or something that you could show me?

exuin | 2021-06-07 12:34

I uploaded the entire project to my Google Drive, please take a look if you can, I would really appreciate it. For some reason, new collisions are being detected as well but are not solid objects and anything else just passes right through.

Thanks for the reply :slight_smile:

New Game Projectsdfsdfsfdsfsdf – Google Drive

kyle_zyster | 2021-06-07 12:45

I put a simple print statement to print the name of the body that the goomba detects. It was TileMap. Which is really weird since the collision layers don’t match up?

exuin | 2021-06-07 13:01

THANK YOU!! Your reply made me figure out exactly what the issue was. It seems I overlooked something small.

The collision box for my side_checker on the goomba was too low and was colliding with the tileset (Even though it shouldn’t have as the layers weren’t masked together). Anyway, I decreased the Y-axis under the transform tab for the CollisionShape2D to be above the tileset. That seemed to have sorted out that issue.

Thanks again for taking the time to help

kyle_zyster | 2021-06-07 13:54