Enemy attack system

So, VERY new to game programming but experienced in programming and Java, how would I go about making an enemy attack the player? I took a course on YouTube by CodeNMore here: https://www.youtube.com/playlist?list=PLah6faXAgguMnTBs3JnEJY0shAc18XYQZ and it is fairly similar to the tutorial given on this site so I should be able to figure some stuff out based on what is given. Right now I want to be able to hurt the player when the enemy touches the player, however I can’t test if the collision box intersects because I never let them intersect. Also, later I would want to make hit boxes for attacking, but setting which way the enemy is facing is difficult due to the tracking system I am using for the enemy. If you have a better tracking system that can work for attacking with hit boxes please let me know ;).
Thanks! ;D

Is this 2D or 3D? Side view, top-down or isometric? Turn-based or realtime? You’ll need to tell us something about the game.