Click here for free DL of the app version that can save data.
No:24399 2608
Prev Next
Movable blocks
Developer anonymous|Date and time 70/1/1 9:41:33
Build time unknown sec|Game capacity 2.493KB|Script


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.
Prev Next   Back  0  0 Menu 

[PR]現在の欲しいものランキング

Click here for free DL of the app version that can save data.

(C)2023 HisashiApp