three实现三维轨道逃亡游戏代码
代码语言:html
所属分类:游戏
代码描述: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>🚂 轨道逃亡 - 3D铁路跑酷</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #000; font-family: 'Arial', sans-serif; }
canvas { display: block; }
#ui {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
}
#hud {
position: absolute;
top: 20px;
left: 20px;
}
.hud-item {
font-size: 22px;
font-weight: bold;
color: #fff;
text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
margin-bottom: 8px;
}
.hud-item span { color: #ffd700; }
#speed-bar {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
width: 200px;
height: 12px;
background: rgba(0,0,0,0.5);
border-radius: 6px;
border: 2px solid #ff8800;
overflow: hidden;
}
#speed-fill {
height: 100%;
width: 60%;
background: linear-gradient(90deg, #ff4400, #ff8800, #ffdd00);
border-radius: 4px;
transition: width 0.3s;
}
#game-over {
display: none;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
pointer-events: auto;
}
#game-over h1 {
font-size: 64px;
color: #ff4444;
text-shadow: 0 0 20px rgba(255,0,0,0.5);
margin-bottom: 20px;
}
#game-over .stats {
font-size: 24px;
color: #fff;
margin-bottom: 30px;
}
#game-over .stats div { margin: 8px 0; }
#game-over .stats span { color: #ffd700; }
#restart-btn {
padding: 15px 50px;
font-size: 22px;
font-weight: bold;
background: linear-gradient(135deg, #ff8800, #ff4400);
color: #fff;
border: none;
border-radius: 30px;
cursor: pointer;
transition: all 0.3s;
pointer-events: auto;
}
#restart-btn:hover {
transform: scale(1.1);
box-shadow: 0 0 30px rgba(255,136,0,0.6);
}
#start-screen {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
pointer-events: auto;
}
#start-screen h1 {
font-size: 56px;
color: #ffd700;
text-shadow: 0 0 30px rgba(255,215,0,0.5);
margin-bottom: 10px;
}
#start-screen .subtitle {
font-size: 18px;
color: #aaa;
margin-bottom: 40px;
}
#start-screen .controls-info {
font-size: 16px;
color: #888;
margin-bottom: 30px;
line-height: 2;
}
#start-screen .controls-info kbd {
background: #333;
color: #fff;
padding: 4px 12px;
border-radius: 4px;
border: 1px solid #555;
font-size: 14px;
}
#start-btn {
padding: 18px 60px;
font-size: 24px;
font-weight: bold;
background: linear-gradient(135deg, #00cc44, #009933);
color: #fff;
border: none;
border-radius: 30px;
cursor: pointer;
transition: all 0.3s;
animation: pulse 1.5s infinite;
}
#start-btn:hover {
transform: scale(1.1);
box-shadow: 0 0 30px rgba(0,204,68,0.6);
}
@keyframes pulse {
0%, 100% { box-shadow: 0 0 10px rgba(0,204,68,0.3); }
50% { box-shadow: 0 0 30px rgba(0,204,68,0.6); }
}
#mobile-controls {
d.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0