Sure! Here's an example of a simple game where you can control the gravity of objects you touch using JavaScript within a single HTML file:
In this game, you control a red square (the player) using touch events. When you touch the player, the gravity changes, causing the player to move in the opposite direction vertically. The objective is to keep the player within the game area boundaries; if it goes outside, the game ends and an alert appears saying "Game Over!"
You can save the above code in a .html file and open it in a web browser (preferably on a smartphone) to play the game.