You are browsing as a guest. Sign up (or log in) to start making projects!

2h 4m 49s logged

DEVLOG -16
This time I added Capy Snake! ๐Ÿ๐ŸŠ Because apparently CAPY was getting bored of sleeping all day.

Built a classic Snake game using HTML Canvas and vanilla JavaScript. Added a 20ร—20 grid, arrow-key movement, oranges to collect, scoring, high scores, and Start/Pause/Restart buttons.

For the code, I made a separate snake.js file. Used an array to store the snakeโ€™s body, setInterval() to move it, and unshift() / pop() to update its position. When the snake eats an orange, it grows, and every 3 oranges the speed increases. High scores are saved using localStorage.

Also added wall and self-collision detection, so CAPY canโ€™t just eat himself and pretend nothing happened ๐Ÿ’€

Had some funny bugs along the way. First I typed fillReact() instead of fillRect() and the entire game board disappeared. Then I had to give the snake a tiny black eye because I couldnโ€™t even tell which side was its head ๐Ÿ˜ญ

Special thanks to these GitHub projects for helping me understand the game logic:

Their code helped me understand how Snake games work, and I used those ideas to build my own version for BASIX OS. Thanks to the creators!

CAPY finally has a game to play. Unfortunately, he keeps eating himself. ๐Ÿฆซ๐Ÿ’€

0
17

Comments 0

No comments yet. Be the first!