Attacks in a game like this require we create what I call an "attack box." Basically, this is a small rectangle that covers the area in which our attack should reach. It should only be activated when we press down on a key, and eventually, it should only register during a specific frame within an animation.
Here we'll add a basic version of attack functionality using just rectangles.
whenever I attack with the enemy, the attack box shows until it touches the player.
Should I change the arrow down code to enemy.attack() ? or should I leave it to enemy.isAttacking = true?