Built to practice state management, game logic, and Canvas API rendering.
This project demonstrates working with React state management, Canvas rendering, and basic game logic architecture.
- keyboard controls (arrow keys)
- dynamic speed increase
- score and best score tracking (localStorage)
- snake self-collision detection
- game loop based on setInterval
- canvas-based rendering
- animated game frame
- responsive canvas rendering
- React (useReducer, hooks)
- Canvas API
- Vite
- CSS (animations, gradients)
Clone the repository and install dependencies:
git clone https://github.com/shabal1nas/snake-game
cd snake-game
npm install
npm run devCreate a production build:
npm run build| Key | Action |
|---|---|
| ↑ | Move Up |
| ↓ | Move Down |
| ← | Move Left |
| → | Move Right |
Created as a learning project while studying React and game logic architecture.
Классическая игра «Змейка», реализованная с использованием React, Canvas API и Vite.
В проекте реализованы:
- управление с клавиатуры
- динамическое увеличение скорости
- система очков и сохранение лучшего результата (localStorage)
- проверка столкновений (стены и тело змейки)
- отрисовка через Canvas API
- анимация рамки игрового поля
Проект выполнен с упором на:
- управление состоянием (useReducer)
- построение игровой логики
- работу с Canvas API


