Sure! Here is a simple example of a 2D fighting game with character selection implemented as a single HTML file using JavaScript:
This code allows you to select a character using left and right arrow keys and start the game by pressing the enter key. The selected character's icon will be displayed on the canvas. The character selection is represented by pictograms (emojis) for each character.
Please keep in mind that this is a basic example to demonstrate the functionality you requested. You can enhance and customize it further according to your specific requirements and game mechanics.