Welcome back to Causality!
Elevator Pitch – “Causality is an action RPG game where you travel through a dungeon to challenge yourself against Monsters. We have a safe area for testing your abilities then a room with a bossfight where your skills are tested. Our target audience is people who likes to challenge their pattern recognition and reaction skills.”
This week i’m going to focus on how I worked and implemented the hit detection on the player’s weapon. The way we did it in our game was that as soon as the player weapon collides with the boss, an OnCollisionEnter function is called to check if the weapon collided with a tag on the boss called “BossBody”. And if that was true the script would then check which camera was active at the time, to see if the player was supposed to deal damage to the boss or if the player was in the other dimension and was supposed to give the player life instead.
We also had a problem that the weapon would deal massive amounts of damage when it hit the boss because the on OnCollisionEnter would check every frame for a hit with the tag “BossBody”, and deal damage every frame the weapon was in the boss. Which meant that the weapon would deal damage 5 times instead of just one. To fix this I did a coroutine that would be activated as soon as the weapon hit the boss. And what that would do is that would disable the collider on the sword, meaning that the weapon would only be able to hit the boss once.