The hero is using a war axe, so it's heavy to manipulate, we imagine it as using a lot of energy to hit a target. In the game every attack and movement (sprint and dodge) uses stamina to be executed, so managing your stamina bar is a very important part of the gameplay.
Here is the complete offensive and defensive move set:
(The animations presented here are not the final outputs, it still needs improvements)
In order, dodge (left/right), parry, attack crouch, attack jump, 3 attacks combo and throwing dagger (+ heavy attack which is not yet done).
Each attack uses a different amount of stamina, makes different damage, they also have different timing. The attack that causes the most damages is the 3 attacks combo, it's a chain of 3 attacks that needs the right timing to be executed. The interesting thing about this combo is that the first attack (the regular attack) uses more stamina than the 2 other attacks of the combo while the damages of the attacks increase gradually. So it's more efficient to use the combo rather than just the regular attack.
To execute a combo you need the right timing. The way it works is that after pressing the attack button you need to wait for your attack to reach a certain percent of completion before to hit the attack button again else it will break the combo. After the first attack you have to wait 50% and above (in this case the axe is almost horizontal), after the second attack you have to wait 65% and above to perform the last attack.
Another useful thing about this combo, specially against slower enemies, is that the second attack breaks the current attack of the opponent. For instance after you dodge the attack of a troll it gives you time to do the first attack then while the troll ready his attack you continue your combo and break him with your second attack. The third attack of the combo charges against the enemy and push him back (even big monsters like trolls) making more damage and give you the time to recover.
Another way to deal damage is to use your daggers. The dwarf has a limited number of dagger with him (you can find them when you explore the world) but when you throw them you can get them back on the floor (so be careful where you throw them). You can throw the daggers in 4 directions (left/right and up/down) and they can reach up to 15 tiles in distance. While they don't deal much damage they can be useful to pull or finish enemy from far or kill smaller opponents like bats. But a better use for them is to set an ambush to your enemy taking advantage of the environment. With a dagger you can trigger explosive barrels or cut the rope of a lantern for it to fall and set the floor in fire, some enemies are very strong so it is a good thing to weaken them before they reach you.
The number of dagger is indicated on the top left of the HUD:
Demonstration against a training dummy:
Health points are sparse in Pantless Hero, when you get hit the only way to refill your health bar is by eating mushroom that you gather yourself. It's then essential to know how to avoid hits.
The basic way to protect yourself is to use the parry. When you parry and you get hit by an enemy it uses your stamina bar instead of your health points. The formula goes like this:
stamina -= (damage * (1 - bonusParry)) * 0.75fhealth -= damage * (1 - parryAbsorption / 100f)//the dwarf absorbs 100% of the damage on parry but some enemies don't
If you don't have enough stamina to absorb it it will use your health points and your parry will be broken. Knowing that the stamina regenerates very slowly when you are in a parry position it's better to use it just before the attack.
When you fight against enemies dealing big damage your stamina will quickly run out if you parry, to avoid that there is the "perfect parry", from the moment you reach the parry position if the attack hits you within 320ms the attack is completely absorbed without using stamina. It requires to know the timing of the opponent's attack and can be risky because if your parry is too late you will get hit.
Another way is to dodge completely the attacks, it is very efficient against fast enemies, but uses a lot of stamina. One advantage of the dodge is that you can do it even if you are currently attacking. Some enemies do attacks that can be avoided if you crouch (like the horizontal attack of the troll).
BEHIND THE SCENE
This is how the combat system works in the code:
The green rectangle is the AABB (classic) the red line and rectangle represent the weapon, when either of the two (it depends of the type of weapon) intersects the AABB it hits the owner of the AABB.
This is the weapon class (a shortened version):
The class is flexible enough to do a lot of different type of attack (need to add diagonal attack though).
It still needs some optimization and adjustment, but all the techniques combined give a rich gameplay, the different possibilities make it fun to play. One of the things we wanted, regarding the fights, is that it is not the character that gets stronger, so fighting gets easier, but because the player himself improves.
You can also enhance your character with mushrooms and runes, but I will talk about it in another entry.