Sure! Here's an example of a simple game that uses movable blocks. The blocks can be moved by dragging them with a mouse or by swiping on a touchscreen device.
In this example, we have a game container (`#game-container`) and two movable blocks (`div.block`). The blocks have a red background color and can be dragged around within the game container.
The JavaScript code inside the `
` tags handles the touch events (`mousedown` and `mousemove`) for the blocks. When a touch event starts (`mousedown`), it stores the initial position of the block relative to the touch coordinates. Then, during the touch move event (`mousemove`), it calculates the new position of the block based on the current touch coordinates and updates the block's position accordingly.
Please note that this implementation assumes touch devices like smartphones. If you want to play the game on a desktop with a mouse, you can modify the event listeners to use `mousedown` and `mousemove` events instead.