[EDIT]Free Friday: 2/6/2026

Today I worked on a browser based mini game project using HTML, CSS, and JavaScript. Instead of just one game, I built two. One is a classic Snake game, and one is a simple platformer. The page lets you switch between them with buttons.

function showSnake() / function showPlatformer():

^These functions switch between the two games. They change which canvas is visible, update the active button, and change the instructions text.

function updateSnake():

^This function handles the Snake game logic. It moves the snake, checks for wall and self collisions, resets the game if needed, and handles food so the snake grows when it eats.

function updatePlatformer():

^This function handles movement and physics for the platformer. It reads key input, applies gravity, allows jumping, and checks collisions with platforms so the player lands correctly.

function snakeLoop(timestamp) / function platformerLoop():

^These are the main loops. They update and draw each game using requestAnimationFrame and only run when that game is active.

Leave a Reply

Your email address will not be published. Required fields are marked *