Sure! Here's a simple shooting game implemented as a single HTML file using JavaScript and enclosed in `` tags:
<br><br>
<br>
<style>
#game {
width: 100%;
height: 70vh;
background-color: #000;
justify-content: center;
align-items: center;
overflow: hidden;
}
#player {
width: 50px;
height: 50px;
background-color: #fff;
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
}
.bullet {
width: 10px;
height: 20px;
background-color: #f00;
position: absolute;
bottom: calc(100% + 5px);
left: 50%;
transform: translateX(-50%);
}
.enemy {
width: 40px;
height: 40px;
background-color: #0f0;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
}
</style>
<div id="game">
<div id="player"></div>
</div>
This code creates a simple shooting game where you control a player object and shoot bullets to hit moving enemy objects. The score is displayed in the page's title, and the game ends if an enemy collides with the player object. The game restarts after displaying the final score in an alert box.
Please note that this is a basic implementation and can be improved upon with additional features and better game mechanics.