Skip to content
View davionyang's full-sized avatar

Block or report davionyang

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Content in all repositories owned by your account will be closed.
Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
davionyang/README.md

🐍 贪吃蛇游戏

一个使用HTML、CSS和JavaScript编写的经典贪吃蛇游戏。

功能特点

  • 🎮 流畅的游戏体验
  • 🎨 现代化的渐变UI设计
  • 📊 实时得分和最高分记录
  • ⚡ 随着得分增加,游戏速度递增
  • 🎯 支持多种键盘控制方式
  • 💾 自动保存最高分记录

如何开始

在浏览器中打开

直接用浏览器打开 snake-game.html 文件即可开始游戏。

# 在Linux/Mac系统中
open snake-game.html

# 或者直接双击文件

游戏操作

控制方式

  • 方向键: ↑ ↓ ← → 控制蛇的移动方向
  • WASD键: W(上) S(下) A(左) D(右)

按钮功能

  • 开始游戏: 开始新游戏
  • 暂停/继续: 暂停或继续当前游戏
  • 重新开始: 重置游戏到初始状态

游戏规则

  1. 控制蛇吃掉红色的食物
  2. 每吃一个食物得10分,蛇身变长
  3. 每得50分,游戏速度会加快
  4. 撞到墙壁或自己的身体会游戏结束
  5. 最高分会自动保存在浏览器本地存储中

技术实现

  • HTML5 Canvas: 用于游戏渲染
  • 原生JavaScript: 游戏逻辑实现
  • CSS3: 现代化UI设计和动画效果
  • LocalStorage: 保存最高分记录

游戏截图

游戏包含以下视觉效果:

  • 渐变紫色背景
  • 发光的蛇身和食物
  • 平滑的动画过渡
  • 响应式的按钮交互

浏览器兼容性

支持所有现代浏览器:

  • Chrome/Edge (推荐)
  • Firefox
  • Safari
  • Opera

许可

本项目仅供学习和娱乐使用。

Popular repositories Loading

  1. davionyang davionyang Public

    Config files for my GitHub profile.

    HTML

  2. google-play-scraper google-play-scraper Public

    Forked from facundoolano/google-play-scraper

    Node.js scraper to get data from Google Play

    JavaScript

  3. ChatGPT-Next-Web ChatGPT-Next-Web Public

    Forked from ChatGPTNextWeb/NextChat

    A well-designed cross-platform ChatGPT UI (Web / PWA / Linux / Win / MacOS). 一键拥有你自己的跨平台 ChatGPT 应用。

    TypeScript

  4. elixir elixir Public

    Forked from elixir-lang/elixir

    Elixir is a dynamic, functional language for building scalable and maintainable applications

    Elixir

  5. hello-scripts hello-scripts Public

    Simple hello world scripts in bash and ruby

    Ruby