A problem I've had for a while now is a glitch where you can run into an enemy from the side and push until you clip through them. After that Clover's collision stops working and you can run through everything like a ghost. To fix that I needed to change the way I approached enemy collision boxes.
In a way similar to how walls work there is an outer layer that prevents sprites with smooth translations from doing so (to avoid wall clipping). That layer is it's own object that recognizes if you are in battle, and if so, it activates the same properties as a wall. Under that layer is the enemy hitbox where it can damage you or you can damage it (assigned with an elemental tag that causes status effects). Just underneath that layer is the character controller collider. That's the one that makes the object move and keep from moving through other solid objects.
With this setup I no longer clip through anything when running about. I still have to test how enemies interact with each other and the environment, but things are looking hopeful right now.
More details on enemies when I finish the current two. |
No comments:
Post a Comment