Adding Melee combat


I played around for a couple of hours with Unity's Distance Joint 2D component to create this melee functionality.

Distance Joint 2D is effectively a 'ball and chain' component. You link it to a GameObject, which then acts as its anchor.

So I created a prefab with a Rigidbody 2D, a DJ 2D and a sword sprite. And anchored it to the player. I spawn them when the player presses the attack button, and they are destroyed after 0.25 secs.

So effectively the melee attack behaves like a short-range projectile, but drags the player along and knocks-back enemies. And brings the hurt!

For now the combat is just thrusts, it's pretty fun - I'd like to expand it to swings, but as Rick at Gamedev.tv says - get it to 'good enough' then move on.

Next up... some form of progression and item management :)

Files

The Catacombs of Venice Play in browser
Jun 27, 2021

Leave a comment

Log in with itch.io to leave a comment.