No thats not implemented in that code.

Its basically just a demonstration to get
an active entity to follow you.

To extend it to an attacking companion,
you need to let the companion switch from
following the player to chasing the enemy.

(using a statemachine or something similar)