A mini snake-like game made with HTML, CSS, and JavaScript, built from scratch with love, logic, and late-night coding. ๐ง ๐ช๐ค
This is my very first game attempt, inspired by the classic Snake.
The logic is built using setInterval, keydown events, and collision detection with food items.
Each time the red square (a.k.a. the โsnakeโ) eats a black square (the โfoodโ), the score increases and a new food item appears randomly on the screen. ๐ฅ
Use your arrow keys to move the red box:
โฌ๏ธ โฌ๏ธ โฌ
๏ธ โก๏ธ
- Smooth movement using
setInterval - Dynamic food generation
- Score counter ๐งฎ
- Responsive to window size
- Minimal code, maximum fun ๐
This project was created to practice:
- DOM manipulation
- Keyboard events
- Timing functions
- Random positioning logic
- Game state management
And to be honest, I enjoyed building it more than playing it. ๐
Love, frustration, coffee, and late-night bugs.
- Add snake tail that grows with each food
- Implement collision with walls
- Add game over logic
- Better UI & animations
