Update 0.4 - Melee combat !


New combat system!

This update contains a simple close combat system. Now an entity can have two different types of attacks, either a ranged attack with a gun or a melee weapon like a sword.


In order to use the close combat attack system with an entity, it needs to have a CloseCombatConfig as its AttackConfig (In its CharacterStatsHandler component). A CloseCombatConfig is really similar to a ShootConfig in how it works.

  • The size will change the scale of the weapon object (a sword for example)
  • The delay is the time between two attacks
  • The power is the amount of damage dealt by the attack
  • The speed indicates the movement speed of the weapon object (the swing speed for example)
  • The target allows you to specify the layer on which the attacks can deal damage
  • The swing angle is exclusive to close combat attacks, it's simply the angle of the swing of the attack.
  • The thrust distance is how much the weapon object will move forward when attacking
  • The two curves allows you to fine tune the movements of both the swing and thrust of the weapon.

Tweaking those values can allow you to create various attack patterns like those :

The other thing you need for this system to work properly is a TopDownCloseCombat component attached to your entity, you now only need to provide a prefab who will be your weapon object. This object needs at least a collider 2D set as a trigger, and a CloseCombatController component to animate the attack.

Files

topdowncontroller2D_v0.4.unitypackage 179 kB
Feb 01, 2022

Get 2D Top down controller for Unity

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.