three实现三维死亡列车游戏代码
代码语言:html
所属分类:其他
代码由gemini-4-hydrogen ai生成,可能有错误,仅供参考:点击查看提示词
代码描述: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, maximum-scale=1.0, user-scalable=no" />
<title>死亡列车 · DEATH TRAIN</title>
<style>
:root {
--rust: #c2410c;
--rust-dark: #7c2d12;
--coal: #0b0d10;
--coal-panel: rgba(14, 17, 23, 0.88);
--coal-border: rgba(194, 65, 12, 0.45);
--whistle: #f59e0b;
--alert: #ef4444;
--hp: #22c55e;
--gold: #fbbf24;
--night: #1e293b;
--cyan: #38bdf8;
--text: #e2e8f0;
--muted: #94a3b8;
}
* { 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(--coal); color: var(--text);
font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
touch-action: none;
}
#game-canvas {
display: block; width: 100%; height: 100%; cursor: crosshair;
}
/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f131a; }
::-webkit-scrollbar-thumb { background: var(--rust); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--whistle); }
/* HUD Layout */
#hud {
position: fixed; inset: 0; pointer-events: none; z-index: 10;
display: none;
}
.hud-panel {
background: var(--coal-panel);
border: 1px solid var(--coal-border);
box-shadow: 0 4px 20px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
backdrop-filter: blur(6px);
border-radius: 6px;
}
/* Top-Left Player Stats */
#hud-stats {
position: absolute; top: 10px; left: 10px; width: 250px; padding: 10px 12px;
}
.stat-header {
display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.lv-badge {
background: linear-gradient(135deg, var(--rust), var(--whistle));
color: #111; font-weight: 800; font-size: 13px; padding: 2px 8px; border-radius: 4px;
}
.hp-bar-wrap {
position: relative; height: 16px; background: #1a1f29; border-radius: 4px;
overflow: hidden; border: 1px solid rgba(255,255,255,0.12); margin-bottom: 7px;
}
.hp-bar-fill {
height: 100%; width: 100%;
background: linear-gradient(90deg, #16a34a, var(--hp));
transition: width 0.15s ease-out;
}
.hp-text {
position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000;
}
.attr-row {
display: flex; justify-content: space-between; font-size: 12px; color: var(--muted);
}
.attr-val { color: var(--text); font-weight: 700; }
.buff-tag { color: var(--whistle); font-size: 11px; margin-left: 2px; }
/* Top-Center Stage & Timer */
#hud-stage {
position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
min-width: 280px; max-width: 92vw; padding: 8px 16px; text-align: center;
}
.station-title {
font-size: 13px; color: var(--whistle); font-weight: 700; letter-spacing: 0.5px;
}
.stage-row {
display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 3px;
}
.stage-pill {
font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
text-transform: uppercase;
}
.stage-travel { background: rgba(245, 158, 11, 0.2); color: var(--whistle); border: 1px solid var(--whistle); }
.stage-stop { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid var(--alert); }
.stage-timer {
font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums;
color: #fff; text-shadow: 0 0 10px rgba(245,158,11,0.4);
}
.stage-timer.urgent { color: var(--alert); animation: pulse 0.6s infinite alternate; }
@keyframes pulse { from { opacity: 1; transform: scale(1); } to { opacity: 0.7; transform: scale(1.06); } }
#boarding-banner {
position: absolute; top: 84px; left: 50%; transform: translateX(-50%);
background: rgba(220, 38, 38, 0.9); color: #fff; font-weight: 800; font-size: 14px;
padding: 6px 18px; border-radius: 6px; border: 2px solid #fca5a5;
box-shadow: 0 0 20px rgba(239,68,68,0.7); display: none; white-space: nowrap;
animation: pulse 0.45s infinite alternate;
}
/* Boss Bar */
#boss-bar-wrap {
position: absolute; top: 122px; left: 50%; transform: translateX(-50%);
width: min(440px, 86vw); padding: 6px 12px; display: none;
}
.boss-head {
display: flex; justify-content: space-between; font-size: 12px; font-weight: 700;
color: #fca5a5; margin-bottom: 4px;
}
.boss-track {
height: 12px; background: #18090c; border: 1px solid rgba(239,68,68,0.5); border-radius: 4px; overflow: hidden;
}
.boss-fill {
height: 100%; width: 100%;
background: linear-gradient(90deg, #991b1b, #ef4444, #f97316);
transition: width 0.12s;
}
/* Top-Right Points & Controls */
#hud-points {
position: absolute; top: 10px; right: 10px; width: 245px; padding: 10px 12px;
}
.pts-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.pts-label { font-size: 11px; color: var(--muted); }
.pts-curr { font-size: 17px; font-weight: 800; color: var(--gold); }
.pts-total { font-size: 14px; font-weight: 700; color: var(--cyan); }
.xp-wrap {
height: 8px; background: #1a1f29; border-radius: 4px; overflow: hidden; margin-top: 4px;
border: 1px solid rgba(255,255,255,0.1);
}
.xp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--whistle), var(--gold)); transition: width 0.2s; }
.xp-text { font-size: 10px; color: var(--muted); text-align: right; margin-top: 2px; }
.top-btns {
display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; pointer-events: auto;
}
.mini-btn {
background: #1e293b; color: var(--text); border: 1px solid rgba(255,255,255,0.18);
border-radius: 4px; padding: 3px 8px; font-size: 11px; cursor: pointer; font-weight: 600;
}
.mini-btn:hover { border-color: var(--whistle); color: var(--whistle); }
/* Mission Tracker */
#hud-mission {
position: absolute; top: 118px; left: 10px; width: 250px; padding: 8px 12px;
}
.mission-tag { font-size: 10px; text-transform: uppercase; color: var(--whistle); font-weight: 800; letter-spacing: 0.8px; }
.mission-desc { font-size: 13px; font-weight: 700; margin: 3px 0; color: #fff; }
.mission-prog { font-size: 12px; color: var(--cyan); font-weight: 700; }
.mission-done { color: var(--hp); }
/* Interact Prompt & Crosshair */
#crosshair {
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
width: 8px; height: 8px; border-radius: 50%;
border: 2px solid rgba(255,255,255,0.6); box-shadow: 0 0 4px rgba(0,0,0,0.8);
}
#interact-prompt {
position: absolute; top: 62%; left: 50%; transform: translateX(-50%);
background: rgba(11,13,16,0.88); border: 1px solid var(--whistle);
color: var(--whistle); padding: 6px 14px; border-radius: 6px;
font-size: 13px; font-weight: 700; display: none; white-space: nowrap;
}
/* Toast Notifications */
#toast-box {
position: absolute; top: 185px; left: 50%; transform: translateX(-50%);
display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.toast {
background: rgba(15, 23, 42, 0.92); border-left: 3px solid var(--whistle);
color: #fff; padding: 6px 14px; border-radius: 4px; font-size: 13px; font-weight: 600;
box-shadow: 0 4px 12px rgba(0,0,0,0.5); animation: toastIn 0.2s ease;
}
.toast.err { border-left-color: var(--alert); color: #fecaca; }
.toast.ok { border-left-color: var(--hp); color: #bbf7d0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
/* Bottom Action Bar */
#hud-bar {
position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
display: flex; gap: 8px; padding: 6px 10px; pointer-events: auto;
flex-wrap: wrap; justify-content: center; max-width: 96vw;
}
.act-btn {
position: relative; background: #141922; border: 1px solid rgba(255,255,255,0.2);
color: var(--text); border-radius: 6px; padding: 6px 10px; font-size: 12px; font-weight: 700;
cursor: pointer; display: flex; align-items: center; gap: 6px; transition: 0.15s;
}
.act-btn:hover:not(:disabled) { border-color: var(--whistle); transform: translateY(-1px); }
.act-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.7); }
.act-btn .k {
background: #273244; color: var(--whistle); padding: 1px 5px; border-radius: 3px; font-size: 10px;
}
.act-btn .cnt { color: var(--hp); font-weight: 800; }
.shop-locked-tag {
color: var(--alert); font-size: 10px; font-weight: 800;
}
/* Damage Vignette & Floating Numbers */
#damage-vignette {
position: fixed; inset: 0; pointer-events: none; z-index: 8;
box-shadow: inset 0 0 90px rgba(239, 68, 68, 0); transition: box-shadow 0.12s;
}
#damage-vignette.hit { box-shadow: inset 0 0 110px rgba(239, 68, 68, 0.75); }
#float-layer {
position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden;
}
.dmg-float {
position: absolute; left: 0; top: 0; font-weight: 900; font-size: 16px;
text-shadow: 0 2px 4px #000; will-change: transform, opacity; white-space: nowrap;
}
/* Modals & Overlays */
.overlay {
position: fixed; inset: 0; z-index: 30;
background: rgba(6, 8, 12, 0.78); backdrop-filter: blur(6px);
display: none; align-items: center; justify-content: center; padding: 16px;
}
.overlay.open { display: flex; }
.modal {
background: linear-gradient(180deg, #131822 0%, #0b0e14 100%);
border: 1px solid var(--rust); border-radius: 10px;
box-shadow: 0 20px 60px rgba(0,0,0,0.85), 0 0 30px rgba(194,65,12,0.2);
width: min(640px, 95vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.1);
display: flex; justify-content: space-between; align-items: center;
background: rgba(194,65,12,0.12);
}
.modal-title { font-size: 18px; font-weight: 800; color: var(--whistle); letter-spacing: 0.5px; }
.modal-body { padding: 16px 18px; overflow-y: auto; font-size: 13px; line-height: 1.55; }
.modal-foot {
padding: 12px 18px; border-top: 1px solid rgba(255,255,255,0.1);
display: flex; justify-content: flex-end; gap: 10px; background: rgba(0,0,0,0.25);
}
.btn {
background: linear-gradient(135deg, var(--rust), #ea580c); color: #fff;
border: none; border-radius: 6px; padding: 9px 18px; font-size: 14px; font-weight: 800;
cursor: pointer; transition: 0.15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sec {
background: #1e293b; border: 1px solid rgba(255,255,255,0.2); color: var(--text);
}
.btn-sec:hover { border-color: var(--whistle); }
/* Shop Grid */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.shop-card {
background: #141a24; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
}
.shop-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.shop-name { font-weight: 800; color: #fff; font-size: 14px; }
.shop-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700; white-space: nowrap; }
.tag-perm { background: rgba(168,85,247,0.2); color: #d8b4fe; border: 1px solid #a855f7; }
.tag-temp { background: rgba(56,189,248,0.2); color: #7dd3fc; border: 1px solid #38bdf8; }
.tag-inv { background: rgba(34,197,94,0.2); color: #86efac; border: 1px solid #22c55e; }
.shop-desc { font-size: 12px; color: var(--muted); }
.shop-buy-row { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.shop-price { font-weight: 800; color: var(--gold); font-size: 14px; }
/* Start Menu */
#menu-overlay {
background: radial-gradient(circle at 50% 35%, rgba(124,45,18,0.35), rgba(6,8,12,0.94));
}
.title-logo {
font-size: clamp(28px, 5vw, 44px); font-weight: 900; letter-spacing: 3px;
background: linear-gradient(180deg, #fef08a 0%, #f59e0b 45%, #dc2626 100%);
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
text-align: center; margin: 4px 0;
}
.title-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 14px; letter-spacing: 2px; }
.rule-box {
background: rgba(15, 20, 28, 0.85); border: 1px solid rgba(255,255,255,0.1);
border-radius: 8px; padding: 12px 14px; margin-bottom: 14px;
}
.rule-box li { margin-bottom: 5px; color: #cbd5e1; }
.diff-group { display: flex; gap: 8px; margin: 10px 0; }
.diff-btn {
flex: 1; padding: 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.18);
background: #141923; color: .........完整代码请登录后点击上方下载按钮下载查看















网友评论0