中文译文
我希望你扮演一名专业的 HTML5 Canvas 游戏开发者。你的任务是基于一种现代化的贪吃蛇机制,编写一个完整、可玩的单文件(index.html)游戏。
游戏规格:
标题:Cyber Grid Link
核心机制:在移动的网格环境中,控制一条由链式矢量粒子组成的蛇。
目标:收集发光的能量矩阵晶体来增长链身,同时躲避移动的防火墙障碍。
技术要求:
单文件:在一个 HTML 文档中使用纯原生 JS,零外部库,零资源下载。
渲染:使用 HTML5 2D Canvas 和 requestAnimationFrame 游戏循环。对蛇身节段移动使用平滑的 LERP 插值,以营造流畅、有机的运动感,而不是经典的块状步进。
控制:方向键或 WASD 进行绝对方向操控。
设计风格:赛博朋克暗色主题。网格必须在蛇头附近通过局部坐标位移产生轻微扭曲。蛇链具有脉动的渐变纹理。
English original
I want you to act as an expert HTML5 Canvas game developer. Your task is to write a complete, playable SINGLE FILE (index.html) game based on a modernized snake mechanic.
GAME SPEC:
Title: Cyber Grid Link
Core mechanic: Control a snake made of chained vector particles on a shifting grid environment.
Goal: Collect glowing energy matrix crystals to grow the link chain while dodging moving firewall barriers.
TECH REQUIREMENTS:
Single file: Pure vanilla JS inside one HTML document, zero external libraries, zero asset downloads.
Rendering: HTML5 2D Canvas with requestAnimationFrame game loop. Smooth LERP interpolation for snake segment movement to create a fluid, organic motion rather than classic blocky steps.
Controls: Arrow keys or WASD for absolute directional steering.
Design style: Cyberpunk dark theme. The grid must warp slightly near the snake's head using localized coordinate displacement. The snake chain features a pulsing gradient texture.