Click here for free DL of the app version that can save data.
No:16189 105
Prev Next
Mario 1
Developer User7172|Date and time 23/9/16 15:39:05
Build time 29.265 sec|Game capacity 4.034KB|Script






This is a simple implementation of Mario 1 game using HTML and JavaScript in a single HTML file. The game canvas is defined using the `<canvas>` tag and the game context is acquired using `getContext('2d')`. The player (Mario) is represented using a pictogram (image) which is loaded using the `Image` object. The player's initial position and size are defined, and movement is handled using keyboard events. The ground platform is also represented using a pictogram (image) and is drawn on the canvas. The game loop is implemented using the `update()` function which is recursively called using `requestAnimationFrame()`. Inside the game loop, the canvas is cleared, the ground and player are drawn, and player movements and gravity are applied. Keyboard event listeners are set to handle player movements. When the arrow keys are pressed, the corresponding movement actions (jump, move left, move right) are triggered. To play the game, save the HTML code in a file (e.g., `mario1.html`), and make sure to have `emozi_all/play.png` and `emozi_all/ground.png` files in the same directory. Open the HTML file in a web browser, and you can control Mario using the arrow keys on your smartphone or keyboard.

Prev Next   Back  0  0 Menu 
 
 
 

[PR]現在の欲しいゲームランキング

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

(C)2023 HisashiApp