Jumping and killing enemies?
Hi! I'm super new at c# programming, well any programming, so most of my questions probably have simple answers and I looked around the similar questions and couldn't find the answer, so I'll try asking: but here's the question anyway: I need to be able to jump on an enemies head to kill them, like mario, but lose a life if you touch is body. Is there something super simple I'm missing as always? Or is it more complex then I think it is?
-PigChop
Answer by joemane22 · Nov 14, 2015 at 06:11 AM
The best way to do this would be to make a wide and tall collider on the bottom of your enemy, then another collider that is thin and short on the top of your enemy. That way you can't touch the top one walking into the enemy and you touch the top one first jumping on the enemy.
I made an small trigger collider under $$anonymous$$ario to detect the enemies and kill them before they touch $$anonymous$$ario's body collider. I kind of work, but if $$anonymous$$ario is falling too fast over the head of an enemy, $$anonymous$$ario and the enemy die. So I'm stuck right there, do you have any suggestion there?