Original date:
Okay… so this nearly drove me crazy.
The walls of the levels are made with tilemaps. I have, for example, a bullet that is of type Area2D and when that bullet registers a collision with the wall/tilemap, it deletes itself. Simple.
I used exactly the same way to detect a collision with a probe object that would tell the Dragon if there is something in the way or not. Basically, the dragon randomly chooses a set of coordinates to jump to and spawns a probe object at those coordinates. If the object collides with something, it sends a signal to the Dragon and suicides, then the Dragon tries again. If no signal is received, the Dragon goes ahead and jumps.
However, whatever I did, the probe would not register any collisions with the tilemap. How can it be that if you do something, it works, but if you do it again, it doesn’t? I checked the settings, they were the same. Collision mask, code, everything.
What eventually made it work was to tell the tileset to handle collisions as if it was a kinetic body rather than a static body. I have no idea what exactly that does, especially since tiles cannot move, but when I checked that box it works. Strangely enough, that was NOT necessary for the bullet thing to work.
A possible explanation would be that even though it’s the same detection (on body entered), it makes a difference wether the object moves against the collider or spawns inside of it.
Well, it works now. I just need to remember to check that box in the future. And to keep an eye out for any possible changes in behavior.
Leave a Reply