I am currently working on a role-playing video game featuring sprites that take the form of antropomorphic objects. These sprites can move around in the four cardinal directions, and turn to face the direction they walk in.
Unlike humans, objects are not as equally proportioned all the way around. What this means is that in the case of at least one of my characters, the side-profile of the sprite is a lot thinner than the front-profile, seeing as the object is a harmonica.
This causes a problem with the character's collisions with objects. If the character walked into, say, a tree while facing sideways, then turned to face the front, a large portion of the sprite will inevitably then be inside the tree.
I've considered multiple potential solutions to the problem, but they all seem to have pretty severe drawbacks.
- Make the side-view hitbox as large as the front-view hitbox. This would mean that players will not be able to walk nearly as close to an object as they should while facing East or West.
- Push the player out of the object when they turn. This would end up looking quite strange and unclean.
- Don't allow the player to turn from a side-view when they're too close to an object. This would be confusing and unintuitive.
- Allow front-view sprites to clip through objects. This would look pretty bad.
I can't think of any other solutions to this problem, nor am I able to choose a different object for this character (for personal reasons). Is what I am attempting to achieve here not viable/possible?
If turning from side to front view and distance from wall < blah, play the "walk backwards" animation
. Be sure to handle the case when you're next to the wall and falling, as that animation would make no sense. You either need an airborne animation or to disallow the movement \$\endgroup\$