three实现三维古墓探险游戏代码
代码语言:html
所属分类:游戏
代码描述:three实现三维古墓探险游戏代码,WASD / 方向键移动,Shift 奔跑,古墓迷宫场景(墙体、柱子、火盆、雾效), 收集 3 个“古代宝石”, 1 个“钥匙”解锁出口
下面为部分代码预览,完整代码请点击下载或在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;
height: 100%;
overflow: hidden;
background: #000;
font-family: "Microsoft YaHei", sans-serif;
}
#game {
width: 100%;
height: 100%;
display: block;
}
#hud {
position: fixed;
left: 14px;
top: 14px;
z-index: 10;
color: #f6e7b5;
background: rgba(20, 12, 6, 0.45);
border: 1px solid rgba(255, 220, 140, 0.2);
border-radius: 12px;
padding: 12px 14px;
user-select: none;
backdrop-filter: blur(4px);
min-width: 240px;
box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
#hud h1 {
margin: 0 0 8px;
font-size: 18px;
color: #ffd88c;
}
#hud p {
margin: 4px 0;
font-size: 14px;
line-height: 1.45;
}
#crosshair {
position: fixed;
left: 50%;
top: 50%;
width: 16px;
height: 16px;
margin-left: -8px;
margin-top: -8px;
z-index: 9;
pointer-events: none;
}
#crosshair::before, #crosshair::after {
content: "";
position: absolute;
background: rgba(255, 233, 180, 0.85);
box-shadow: 0 0 8px rgba(255, 210, 120, 0.35);
}
#crosshair::before {
left: 7px;
top: 0;
width: 2px;
height: 16px;
}
#crosshair::after {
left: 0;
top: 7px;
width: 16px;
height: 2px;
}
#startScreen, #winScreen {
position: fixed;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
z-index: 20;
background:
radial-gradient(circle at center, rgba(50,30,10,.45), rgba(0,0,0,.85));
}
.panel {
width: min(92vw, 460px);
background: rgba(18, 11, 7, 0.92);
color: #f5e6b8;
border: 1px solid rgba(255, 214, 120, 0.22);
border-radius: 18px;
padding: 26px 24px;
box-shadow: 0 20px 60px rgba(0,0,0,.45);
text-align: center;
}
.panel h2 {
margin: 0 0 10px;
color: #ffd07f;
font-size: 28px;
}
.panel p {
margin: 8px 0;
line-height: 1.6;
color: #ead9aa;
}
.panel button {
m.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0