Can anyone help me out with how to take out enemies by jumping on their heads i.e. Super Mario?
I’ve found a couple of tutorials on YouTube like this one but the problem I have with all the ones I’ve encountered so far is that they all seem involve placing a collision box on top of the enemy. The reason that this a problem for me is that if the player were to land on the enemy’s face instead of the top of their head then the player would take damage. I would much prefer that if the player lands on the enemy’s face/backside/whatever with a jump it should count as a hit on the enemy rather the player.
So to accomplish this, I decided instead to try and attach a collision box to the bottom of my character, using these tutorials I found Link #1] Link #2] to setup the collision between the player and a cube standing in for the enemy. The aforementioned tutorials were intended for setting up a punching attack but I figured it could be modified to suit my own intended purposes.
Unfortunately though, the collision between the player and the “enemy” box isn’t working as the way that I hoped. For example, when the player lands on top of the enemy’s “head” near the middle, the player lands without registering a hit or bouncing off the “head” of the enemy. A hit will only register if the player instead lands near the very outer edge of the cube for some reason. Similarly, if the player runs into the “enemy”, nothing happens, which is what ideally should happen but for some bizarre reason if the player turns around then they are bounced away from the “enemy” box with a hit registered. So clearly something is wrong with the way that the jumping collision box is setup and I need help with identifying what’s wrong.
I was also wondering if I need to do something to limit the collision with the jump hit box to the Z-axis in order to prevent it from dealing damage to enemies by running into them. As I previously mentioned, running into the “enemy” box right now doesn’t register a hit which is good but I’m afraid that it its result of whatever is causing the jump collision to not work properly.
As always, any help would be greatly appreciated!