Sure! Here's an example of a 2D action game implemented as a single HTML file using JavaScript:
This implementation creates a canvas element with a size of 500x500 pixels to display the game. You control the blue cube by touching and dragging on the canvas. The objective is to eat all the black cubes while avoiding the red cubes. As you eat black cubes, the blue cube grows bigger and faster. Once you eat all 200 black cubes, you win the game. If you collide with a red cube while being smaller, the game is over.