1. Enemy takes more/twice the damage due to BoxCollider2D.
[You can choose between adding a code to the Enemy.cs or the PlayerController.cs. In the series, we have decided to go with the PlayerController.cs method, but both methods work.]
Change private float timeBetweenAttack; to [SerializeField] private float timeBetweenAttack;. in PlayerController.cs
[Header("Attack Settings:")]
[SerializeField] private Transform SideAttackTransform; //the middle of the side attack area
[SerializeField] private Vector2 SideAttackArea; //how large the area of side attack is
[SerializeField] private Transform UpAttackTransform; //the middle of the up attack area
[SerializeField] private Vector2 UpAttackArea; //how large the area of side attack is
[SerializeField] private Transform DownAttackTransform; //the middle of the down attack area
[SerializeField] private Vector2 DownAttackArea; //how large the area of down attack is
[SerializeField] private LayerMask attackableLayer; //the layer the player can attack and recoil off of
private float timeBetweenAttack, timeSinceAttack;
[SerializeField] private float timeBetweenAttack;
private float timeSinceAttack;
timeBetweenAttack is the attack cooldown, however it is kept at 0 by default as it has not been set to a value and there is no influence to this value through code.
Common Issues
4. ___ does not take damage.
Ensure the Player has the “Player” tag assigned to them.
Set the Player’s “Attackable Layer” to “Attackable”
Ensure the Enemy has the “Attackable” Layer assigned to them.
Assign the “Player” tag to the Player GameObject.Set “Attackable Layer” to “Attackable”.Assign the “Attackable” layer to the Enemy GameObject.
That will be all for Part 3.
Hopefully this can help you on any issues you may have. However, if you find that your issues weren’t addressed or is a unique circumstance, you can submit a forum post to go into detail on your problem for further assistance.