three实现三维飞行鸟游戏代码

代码语言:html

所属分类:游戏

代码描述:three实现三维飞行鸟游戏代码,你控制一只小鸟穿过不断靠近的三维墙体。不能碰到墙,否则立即失败。尽量穿过每个墙体中间的空洞,飞得越久分数越高。

代码标签: three 三维 飞行鸟 游戏 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
  <title>Three.js 三维飞行鸟游戏</title>
  <style>
    * { box-sizing: border-box; }
    html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: linear-gradient(#bfe9ff 0%, #dcefff 45%, #f9f4ea 100%);
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      user-select: none;
      touch-action: none;
    }

    canvas {
      display: block;
      position: fixed;
      inset: 0;
      cursor: pointer;
    }

    #ui {
      position: fixed;
      inset: 0;
      z-index: 10;
      pointer-events: none;
    }

    .hud {
      position: absolute;
      top: 12px;
      left: 12px;
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .card {
      pointer-events: none;
      min-width: 120px;
      padding: 10px 14px;
      border-radius: 16px;
      color: #fff;
      background: rgba(18, 24, 40, 0.44);
      border: 1px solid rgba(255,255,255,0.12);
      backdrop-filter: blur(10px);
      box-shadow: 0 10px 28px rgba(0,0,0,0.16);
    }

    .card small {
      display: block;
      font-size: 11px;
      opacity: 0.75;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      margin-bottom: 4px;
    }

    .card .value {
      font-size: 18px;
      font-weight: 800;
      line-height: 1.1;
    }

    #tip {
      position: absolute;
      left: 50%;
      bottom: 12px;
      transform: translateX(-50%);
      padding: 9px 14px;
      border-radius: 999px;
      color: rgba(255,255,255,0.92);
      background: rgba(10, 12, 18, 0.45);
      border: 1px solid rgba(255,255,255,0.12);
      font-size: 13px;
      white-space: nowrap;
      backdrop-filter: blur(10px);
      box-shadow: 0 10px 24px rgba(0,0,0,0.16);
    }

    .overlay {
      position: fixed;
      inset: 0;
      z-index: 20;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(7, 10, 18, 0.56);
      backdrop-filter: blur(8px);
      pointer-events: auto;
    }

    .hidden { display: none !important; }

    .panel {
      width: min(680px, calc(100vw - 24px));
      padding: 26px;
      border-radius: 24px;
      color: #fff;
      background: linear-gradient(180deg, rgba(20, 26, 42, 0.92), rgba(10, 14, 24, 0.90));
      border: 1px solid rgba(255,255,255,0.10);
      box-shadow: 0 24px 70px rgba(0,0,0,0.42);
    }

    .panel h1 {
      margin: 0 0 8px;
      font-size: 32px;
      letter-spacing: -0.03em;
    }

    .panel p {
      margin: 10px 0;
      line-height: 1.6;
      color: rgba(255,255,255,0.78);
    }

    .btnRow {
      display: flex;
      gap: 12px;
      margin-top: 18px;
      flex-wrap: wrap;
    }

    button {
      pointer-events: auto;
      appearance: none;
      border: 0;
      cursor: pointer;
      border-radius: 16px;
      padding: 12px 18px;
      color: #fff;
      font: inherit;
      font-weight: 800;
      background: linear-gradient(180deg, #7b5cff, #5a36df);
      box-shadow: 0 12px 26px rgba(90, 54, 223, 0.33);
      transition:.........完整代码请登录后点击上方下载按钮下载查看

网友评论0