I built this in my first week of a coding bootcamp. The challenge was to build a game using only vanilla javascript and CSS.
I made heavy use of CSS grid to establish a two-dimensional space in which each cell had a unique class that could be referenced via x and y coordinates. Giving each cell an x and y position embedded in it's class allowed me to govern both the player and enemy sprite movement, and build game-logic when the player and enemy sprites touched.