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>皇牌空战 - ACE COMBAT 3D</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { overflow: hidden; background: #000; font-family: 'Courier New', monospace; cursor: none; }
canvas { display: block; }
#hud {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
pointer-events: none; z-index: 10;
}
.hud-element {
position: absolute; color: #00ff88; font-size: 14px;
text-shadow: 0 0 10px #00ff88;
}
#speed-alt {
bottom: 60px; left: 40px;
font-size: 16px; line-height: 1.8;
}
#weapons {
bottom: 60px; right: 40px;
text-align: right; font-size: 16px; line-height: 1.8;
}
#radar {
bottom: 40px; left: 50%;
width: 160px; height: 160px;
border: 2px solid rgba(0,255,136,0.6);
border-radius: 50%;
background: rgba(0,20,10,0.7);
}
#crosshair {
position: absolute; top: 50%; left: 50%;
transform: translate(-50%, -50%);
width: 80px; height: 80px;
pointer-events: none;
}
#target-box {
position: absolute;
border: 2px solid #ff3333;
pointer-events: none;
display: none;
box-shadow: 0 0 10px rgba(255,50,50,0.5);
}
#lock-indicator {
position: absolute; top: 50%; left: 50%;
transform: translate(-50%, -50%);
color: #ff3333; font-size: 20px; font-weight: bold;
display: none;
text-shadow: 0 0 15px #ff0000;
animation: blink 0.3s infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
#damage-overlay {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
pointer-events: none; z-index: 5;
border: 0px solid rgba(255,0,0,0);
transition: border 0.1s;
}
#score-display {
position: absolute; top: 30px; right: 40px;
color: #ffcc00; font-size: 22px;
text-shadow: 0 0 15px #ffcc00;
}
#health-bar-container {
position: absolute; top: 30px; left: 40px;
width: 200px;
}
#health-bar-bg {
width: 100%; height: 14px;
background: rgba(255,0,0,0.2);
border: 1px solid rgba(0,255,136,0.5);
}
#health-bar {
width: 100%; height: 100%;
background: linear-gradient(90deg, #00ff88, #00cc66);
transition: width 0.3s;
}
#health-text {
color: #00ff88; font-size: 12px; margin-top: 2px;
text-shadow: 0 0 8px #00ff88;
}
#missile-alert {
position: absolute; top: 50%; left: 50%;
transform: translate(-50%, calc(-50% + 80px));
color: #ff0000; font-size: 28px; font-weight: bold;
display: none;
text-shadow: 0 0 20px #ff0000;
animation: blink 0.2s infinite;
}
#game-over {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0,0,0,0.85);
display: none; z-index: 100;
flex-direction: column;
align-items: center; justify-content: center;
color: white;
}
#game-over h1 {
font-size: 60px; color: #ff3333;
text-shadow: 0 0 30px #ff0000;
margin-bottom: 20px;
}
#game-over p {
font-size: 24px; color: #ffcc00;
margin-bottom: 30px;
}
#game-over button {
padding: 15px 40px; font-size: 20px;
background: transparent; color: #00ff88;
border: 2px solid #00ff88;
cursor: pointer; pointer-events: all;
font-family: 'Courier New', monospace;
transition: all 0.3s;
}
#game-over button:hover {
background: #00ff88; color: #000;
}
#start-screen {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
background: linear-gradient(180deg, #000510 0%, #001a33 50%, #000510 100%);
z-index: 200;
display: flex; flex-direction: column;
align-items: center; justify-content: center;
color: white;
}
#start-screen h1 {
font-size: 72px; color: #00ccff;
text-shadow: 0 0 40px #0088ff, 0 0 80px #0044aa;
margin-bottom: 10px;
letter-spacing: 8px;
}
#start-screen h2 {
font-size: 24px; color: #ffcc00;
margin-bottom: 50px;
letter-spacing: 4px;
}
#start-screen .controls-info {
color: #88aacc; font-size: 14px;
line-height: 2.2; margin-bottom: 40px;
text-align: center;
}
#start-screen button {
padding: 18px 60px; font-size: 24px;
background: transparent; color: #00ccff;
border: 2px solid #00ccff;
cursor: pointer;
font-family: 'Courier New', monospace;
letter-spacing: 4px;
transition: all 0.3s;
animation: pulse 2s infinite;
}
#start-screen button:hover {
background: #00ccff; color: #000;
}
@keyframes pulse {
0%, 100% { box-shadow: 0 0 10px rgba(0,204,255,0.3); }
50% { box-shadow: 0 0 30px rgba(0,204,255,0.6); }
}
#warning-text {
position: absolute; top: 120px; left: 50%;
transform: translateX(-50%);
color: #ff6600; font-size: 18px;
display: none;
text-shadow: 0 0 15px #ff6600;
}
#kill-feed {
position: absolute; top: 80px; left: 50%;
transform: translateX(-50%);
text-align: center;
}
.kill-message {
color: #ffcc00; font-size: 20px;
text-shadow: 0 0 15px #ffcc00;
animation: fadeUp 2s forwards;
margin: 5px 0;
}
@keyframes fadeUp {
0% { opacity: 1; transform: translateY(0); }
100% { opacity: 0; transform: translateY(-30px); }
}
</style>
</head>
<body>
<div id="start-screen">
<h1>ACE COMBAT</h1>
<h2>— 皇 牌 空 战 —</h2>
<div class="controls-info">
W / S — 俯仰操控<br>
A / D — 横滚<br>
Q / E — 偏航<br>
SHIFT — 加速 | CTRL — 减速<br>
鼠标左键 / J — 机炮<br>
SPACE — 发射导弹<br>
TAB — 切换锁定目标<br>
F — 发射干扰弹
</div>
<button onclick="startGame()">START MISSION</button>
</div>
<div id="hud">
<div id="crosshair">
<svg width="80" height="80" viewBox="0 0 80 80">
<circle cx="40" cy="40" r="30" fill="none" stroke="#00ff88" stroke-width="1.5" opacity="0.7"/>
<circle cx="40" cy="40" r="3" fill="#00ff88" opacity="0.9"/>
<line x1="10" y1="40" x2="25" y2="40" stroke="#00ff88" stroke-width="1.5" opacity="0.7"/>
<line x1="55" y1="40" x2="70" y2="40" stroke="#00ff88" stroke-width="1.5" opacity="0.7"/>
<line x1="40" y1="10" x2="40" y2="25" stroke="#00ff88" stroke-width="1.5" opacity="0.7"/>
<line x1="40" y1="55" x2="40" y2="70" stroke="#00ff88" stroke-width="1.5" opacity="0.7"/>
</svg>
</div>
<div id="target-box"></div>
<div id="lock-indicator">◆ LOCKED ◆</div>
<div id="missile-alert">⚠ MISSILE ALERT ⚠</div>
<div id=&q.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0