Need help coding enemies to new web game in HTML/JavaScript

What paint(ctx) is about… I have two rules that I always try to follow when doing components “Separation of concerns” and “code inside the component should have no understanding of whats outside of it”. The separation one is about making each component do one specific thing. Can be hard trying to decide how much to split stuff up and what belongs where some times. And the other one is about the code inside the function only knows about what it was told about, it never just knows about other components/code outside of itself unless that info was passed to it. This makes sure your code is more reusable amongst other things. For instance in your code you have let ctx = myGameArea.context; inside component. So now to use component you have to have the object named myGameArea, it cant be named anything else. It also just helps me visualize how things are connected easier. So with the entities I wasnt sure if to pass the gameArea during construction or the way I did it. The way I did it is easier for switching context which I used a while back so guess it was still in my head.|

Entity is the base component that both player and follower extend from. In your code Enemy extends from GamePiece so thought Id show you the class version. Youd be best to read about class’s somewhere (MDN as usual) to understand all that.