Here's an example of how the game mechanics can be implemented in a single HTML file using JavaScript. Please note that this is a simplified version, and you may need to add additional functionalities and styling to make it a complete game.
This is a basic implementation of the game mechanics you requested. You can run this code in a web browser to see it in action. However, please note that this is just a starting point, and you may want to add additional features, such as scoring, levels, and more complex enemy behavior, to make it a complete game.