- https://developer.mozilla.org/en-US/docs/WebAssembly/Concepts
- https://rustwasm.github.io/docs/book/
- https://leptos-rs.github.io/leptos/01_introduction.html
-
make snake in JS and then in Leptos
- steps:
-
Set up the game canvas: Create a canvas element in your HTML file and use JavaScript to get its context, set its width and height, and clear it before each frame.
-
Set up the game loop: Use requestAnimationFrame to create a loop that updates the game state and redraws the canvas every frame.
-
Create the snake: Define the initial position and size of the snake, and create an array to store its body segments. Move the snake by updating the position of its head and adding a new body segment at the front.
-
Add food: Generate a random position for the food and check for collisions with the snake. If the snake eats the food, increase its size and generate a new food.
-
Handle user input: Use the keyboard or touch events to allow the user to control the snake's direction.
-
Detect collisions: Check for collisions between the snake and the walls or its own body. If the snake collides with something, end the game.
-
Update the score: Keep track of the player's score based on the number of food items eaten.
-
Add game over screen: When the game ends, display a message to the user and allow them to restart the game.
-
-
- steps:
-
make I love Hue in JS and then in Leptos
- VUE 3 and Leptos?
#DONZO