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" />
  <title>海岛火炮防御战 - Three.js</title>
  <style>
    html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: #6bb7ff;
      font-family: Arial, Helvetica, sans-serif;
    }

    #game {
      position: fixed;
      inset: 0;
    }

    .hud {
      position: fixed;
      top: 12px;
      left: 12px;
      z-index: 20;
      color: #fff;
      background: rgba(0,0,0,0.28);
      padding: 12px 14px;
      border-radius: 12px;
      backdrop-filter: blur(6px);
      min-width: 220px;
      user-select: none;
      line-height: 1.7;
    }

    .hud .title {
      font-size: 18px;
      font-weight: bold;
      margin-bottom: 6px;
    }

    .bar-wrap {
      width: 180px;
      height: 12px;
      border-radius: 999px;
      overflow: hidden;
      background: rgba(255,255,255,0.18);
      margin-top: 4px;
      margin-bottom: 6px;
    }

    .bar {
      height: 100%;
      width: 100%;
      background: linear-gradient(90deg, #37d16c, #9ef56d);
      transition: width 0.2s ease;
    }

    .top-banner {
      position: fixed;
      top: 10px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 20;
      background: linear-gradient(180deg, #9a2417, #75180f);
      color: #ffd86b;
      padding: 10px 20px;
      border-radius: 10px;
      box-shadow: 0 4px 20px rgba(0,0,0,0.25);
      font-weight: bold;
      user-select: none;
    }

    .help {
      position: fixed;
      right: 12px;
      top: 12px;
      z-index: 20;
      color: #fff;
      background: rgba(0,0,0,0.28);
      padding: 12px 14px;
      border-radius: 12px;
      backdrop-filter: blur(6px);
      line-height: 1.8;
      user-select: none;
    }

    .bottom {
      position: fixed;
      left: 50%;
      bottom: 14px;
      transform: translateX(-50%);
      z-index: 20;
      color: white;
      background: rgba(0,0,0,0.25);
      border-radius: 12px;
      padding: 10px 16px;
      backdrop-filter: blur(6px);
      user-select: none;
    }

    .msg {
      position: fixed;
      inset: 0;
      z-index: 25;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
    }

    .msg .panel {
      color: white;
      background: rgba(0,0,0,0.35);
      backdrop-filter: blur(8px);
      padding: 18px 28px;
      border-radius: 16px;
      font-size: 28px;
      font-weight: bold;
      opacity: 0;
      transform: scale(0.95);
      transition: all .25s ease;
      text-align: center;
    }

    .msg.show .panel {
      opacity: 1;
      transform: scale(1);
    }

    button {
      pointer-events: auto;
      cursor: pointer;
      border: none;
      border-radius: 8px;
      padding: 8px 12px;
      font-weight: bold;
      background: #ffd86b;
      color: #5b2a00;
      margin-left: 8px;
    }
  </style>
</head>
<body>
  <div id="game"></div>

  <div class="top-banner">
    海岛防御战 金币 <span id="goldText">120</span>.........完整代码请登录后点击上方下载按钮下载查看

网友评论0