js使用Sprite-Stacking(精灵堆叠 / 体素分层渲染) 技术伪三维空中战斗机射击游戏代码

代码语言:html

所属分类:其他

代码由gemini-4 ai生成,可能有错误,仅供参考:点击查看提示词

代码描述:伪三维空中战斗机射击游戏

代码标签: js 使用Sprite-Stacking(精灵堆叠 / 体素分层渲染) 技术 伪 三维 空中 战斗机

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

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>VX-99 SKY FANG // Sprite-Stacking 伪三维空战</title>
<style>
  :root {
    --cyan: #00f0ff;
    --orange: #ff9f1c;
    --red: #ff2a54;
    --green: #2ee59d;
    --bg: #040d1a;
  }
  * {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
  }
  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', monospace, sans-serif;
    color: #eaf6ff;
  }
  #gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
  }

  /* HUD Overlay */
  #hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 10;
  }
  .hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
  }
  .panel {
    background: rgba(6, 18, 36, 0.72);
    border: 1px solid rgba(0, 240, 255, 0.28);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), inset 0 0 12px rgba(0, 240, 255, 0.08);
    backdrop-filter: blur(4px);
    border-radius: 8px;
    padding: 10px 14px;
  }
  .stats-left {
    min-width: 220px;
  }
  .bar-row {
    margin-bottom: 7px;
  }
  .bar-row:last-child {
    margin-bottom: 0;
  }
  .bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #9ec5df;
    margin-bottom: 3px;
    font-weight: 700;
  }
  .bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
  }
  .bar-fill {
    height: 100%;
    width: 100%;
    transition: width 0.12s ease-out;
  }
  #hpBar { background: linear-gradient(90deg, #ff2a54, #2ee59d); }
  #rollBar { background: linear-gradient(90deg, #0088ff, #00f0ff); }

  .badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 700;
  }
  .badge {
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(0, 240, 255, 0.14);
    border: 1px solid rgba(0, 240, 255, 0.35);
    color: var(--cyan);
  }
  .badge.shield {
    background: rgba(46, 229, 157, 0.15);
    border-color: rgba(46, 229, 157, 0.45);
    color: var(--green);
  }
  .badge.rapid {
    background: rgba(255, 159, 28, 0.16);
    border-color: rgba(255, 159, 28, 0.5);
    color: var(--orange);
  }

  .stats-right {
    text-align: right;
    min-width: 190px;
  }
  .score-val {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
    line-height: 1.1;
  }
  .meta-line {
    font-size: 12px;
    color: #8cb7d4;
    margin-top: 3px;
    font-weight: 600;
  }
  .combo-tag {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 159, 28, 0.22);
    border: 1px solid var(--orange);
    color: #ffd166;
    font-size: 12px;
    font-weight: 800;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.15s, transform 0.15s;
  }
  .combo-tag.active {
    opacity: 1;
    transform: scale(1);
  }

  .hud-controls {
    pointer-events: auto;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 8px;
  }
  .btn-mini {
    background: rgba(12, 32, 60, 0.85);
    border: 1px solid rgba(158, 197, 223, 0.35);
    color: #cce7fa;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .btn-mini:hover {
    border-color: var(--cyan);
    color: #fff;
  }
  .btn-mini.on {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--cyan);
    color: var(--cyan);
  }

  /* Boss Bar */
  #bossHud {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: min(420px, 50vw);
    display: none;
    z-index: 11;
    pointer-events: none;
  }
  #bossHud.active {
    display: block;
  }
  .boss-title {
    text-align: center;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ff5c7c;
    text-shadow: 0 0 8px rgba(255, 42, 84, 0.7);
    margin-bottom: 5px;
  }
  .boss-track {
    height: 11px;
    background: rgba(20, 8, 16, 0.8);
    border: 1px solid rgba(255, 42, 84, 0.65);
    border-radius: 6px;
    overflow: hidden;
  }
  #bossBar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff2a54, #ff9f1c);
    transition: width 0.08s linear;
  }

  /* Banner Alert */
  #waveBanner {
    position: fixed;
    top: 28%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    padding: 12px 32px;
    background: rgba(6, 18, 36, 0.85);
    border-top: 2px solid var(--cyan);
    border-bottom: 2px solid var(--cyan);
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #ffffff;
    text-shadow: 0 0 16px rgba(0, 240, 255, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 15;
    text-align: center;
  }
  #waveBanner.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  #waveBanner.boss {
    border-color: var(--red);
    color: #ff6b88;
    text-shadow: 0 0 18px rgba(255, 42, 84, 0.9);
  }

  /* Overlays */
  .overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(6, 20, 42, 0.45) 0%, rgba(3, 10, 22, 0.86) 100%);
    z-index: 20;
    padding: 20px;
  }
  .overlay.hidden {
    display: none;
  }
  .modal {
    max-width: 520px;
    width: 100%;
    background: rgba(8, 22, 44, 0.88);
    border: 1px solid rgba(0, 240, 255, 0.4);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.65), inset 0 0 28px rgba(0, 240, 255, 0.1);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    padding: 28px 30px;
    text-align: center;
  }
  .modal h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff 20%, #00f0ff 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .subtitle {
    margin: 6px 0 20px;
    font-size: 13px;
    letter-spacing: 1.5px;
    color: #8ab8d8;
    text-transform: uppercase;
  }
  .controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    text-align: left;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 22px;
    font-size: 13px;
    color: #cde6f7;
  }
  .key {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 240, 255, 0.16);
    border: 1px solid rgba(0, 240, 255, 0.45);
    color: var(--cyan);
    font-weight: 800;
    font-size: 11px;
    margin-right: 4px;
  }
  .btn-primary {
    background: linear-gradient(135deg, #00c8ff, #0077ff);
    border: none;
    border-radius: 8px;
    padding: 13px 34px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0, 168, 255, 0.45);
    transition: transform 0.12s, box-shadow 0.12s;
  }
  .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 210, 255, 0.65);
  }
  .btn-primary:active {
    transform: translateY(0);
  }
  .final-stats {
    margin: 16px 0 22px;
    font-size: 16px;
    line-height: 1.8;
    color: #d6ecfa;
  }
  .final-stats strong {
    color: var(--cyan);
    font-size: 20px;
  }
  .hud-bottom-hint {
    text-align: center;
    font-size: 11px;
    color: rgba(180, 215, 240, 0.65);
    letter-spacing: 0.6px;
  }
</style>
</head>
<body>

<canvas id="gameCanvas"></canvas>

<!-- HUD -->.........完整代码请登录后点击上方下载按钮下载查看

网友评论0