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
A real-time 2D dungeon crawler (GDTV '21 gamejam entry)
Status | Released |
Author | christh |
Genre | Action |
Tags | 2D, dualstick, Dungeon Crawler, gamepad, keyboardmouse, Pixel Art, Singleplayer, Unity |
Languages | English |
More posts
- Fire Flickers, Destructible Objects and Mood LightingJun 26, 2021
- Update - bug squashing and more forsoothJun 13, 2021
- Added Joypad controlsJun 09, 2021
- Balance UpdateJun 07, 2021
Leave a comment
Log in with itch.io to leave a comment.