Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 贪吃蛇游戏

一个使用 HTML5 Canvas、CSS3 和原生 JavaScript 编写的现代化贪吃蛇游戏。

✨ 特性

  • 🎮 流畅的键盘控制(方向键)
  • 🎨 精美的渐变视觉效果
  • 📊 实时分数和最高分记录(本地存储)
  • 🚀 游戏速度递增,挑战性更强
  • 📱 响应式设计
  • 🔄 支持重新开始

🎯 如何玩

  1. 使用 ↑ ↓ ← → 方向键控制蛇的移动
  2. 吃掉红色的食物来获得分数
  3. 避免撞到墙壁或自己的身体
  4. 每吃掉一个食物,蛇会变长,速度也会增加
  5. 点击"重新开始"按钮可以重新开始游戏

🚀 快速开始

直接在浏览器中打开 index.html 文件即可开始游戏:

# macOS
open index.html

# Linux
xdg-open index.html

# Windows
start index.html

或者使用 Python 启动本地服务器:

python3 -m http.server 8000
# 然后访问 http://localhost:8000

📁 项目结构

snake-game/
├── index.html    # 游戏主页面
├── style.css     # 样式文件
├── script.js     # 游戏逻辑
└── README.md     # 说明文档

🛠️ 技术栈

  • HTML5 Canvas - 游戏渲染
  • CSS3 - 动画和视觉效果
  • JavaScript (ES6+) - 游戏逻辑
  • Local Storage - 最高分持久化

📝 许可

MIT License

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages