All Questions

Community

D
M D(mpd)
posted to: Creating the Enemy

Collisions with walls 1 tile wide

I wrote the enemy code and when it hits the player, it stops.  This seems as it should be.  I then tested it jumping over the enemy - and the enemy carries on, but instead of stopping (or changing direction when it collides with the wall, it seemed to go through the wall.  The collision layer and masks were set correctly (otherwise it wouldn't detect the collision with the floor.  I then tested with the player and it to was able to go through the walls.  I checked if there was anything in actor to cause this - with no success.


I then noticed that the floor I had made 2 tiles wide and the walls 1 tile wide.  I modified it to be 2 tiles wide and it now works correctly.  Is this because of the collision being tested on each frame and reacted to the next frame?  So with 1 tile it has essentially passed the wall by the time it tries to react to the collision?  Any thoughts?


  • GDQuestions replied

    Unless the collision boxes are really tiny, this shouldn't happen. Without probing the project, I can't tell you what's the cause.

    If you'd like, you can upload your project folder as a .zip file to a platform like Google drive and share the download link here. I'll take a look and let you know what happened.