three实现坦克炮轰ufo飞碟三维游戏代码
代码语言:html
所属分类:游戏
代码描述:three实现坦克炮轰ufo飞碟三维游戏代码
代码标签: three 坦克 炮轰 ufo 飞碟 三维 游戏 代码
下面为部分代码预览,完整代码请点击下载或在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>UFO猎手 - 3D坦克射击</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #000; overflow: hidden; font-family: 'Arial', sans-serif; }
canvas { display: block; }
#hud {
position: fixed; top: 20px; left: 20px;
color: #00ff88; font-size: 18px;
text-shadow: 0 0 10px #00ff88;
pointer-events: none; z-index: 10;
}
#score-display { font-size: 28px; font-weight: bold; margin-bottom: 8px; }
#health-bar-container { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
#health-bar {
width: 200px; height: 16px;
background: #333; border: 2px solid #00ff88;
border-radius: 8px; overflow: hidden;
}
#health-fill {
height: 100%;
background: linear-gradient(90deg, #ff4444, #ffaa00, #00ff88);
background-size: 300% 100%;
transition: width 0.3s, background-position 0.3s;
border-radius: 6px;
}
#level-display { font-size: 16px; color: #ffaa00; text-shadow: 0 0 10px #ffaa00; }
#combo-display {
font-size: 22px; color: #ff88ff; font-weight: bold;
text-shadow: 0 0 15px #ff88ff;
transition: all 0.2s; opacity: 0;
}
#combo-display.active { opacity: 1; }
/* 准星 */
#crosshair {
position: fixed; top: 50%; left: 50%;
transform: translate(-50%, -50%);
width: 44px; height: 44px;
pointer-events: none; z-index: 10;
transition: transform 0.1s;
}
.ch-line {
position: absolute; background: rgba(255,255,100,0.9);
box-shadow: 0 0 4px rgba(255,255,100,0.5);
}
.ch-top { width: 2px; height: 12px; top: 0; left: 21px; }
.ch-bottom { width: 2px; height: 12px; bottom: 0; left: 21px; }
.ch-left { width: 12px; height: 2px; top: 21px; left: 0; }
.ch-right { width: 12px; height: 2px; top: 21px; right: 0; }
.ch-dot {
width: 4px; height: 4px; border-radius: 50%;
background: rgba(255,255,100,0.9);
top: 50%; left: 50%; transform: translate(-50%,-50%);
}
.ch-ring {
width: 28px; height: 28px;
border: 1.5px solid rgba(255,255,100,0.5);
border-radius: 50%;
top: 50%; left: 50%; transform: translate(-50%,-50%);
}
.ch-top,.ch-bottom,.ch-left,.ch-right,.ch-dot,.ch-ring { position: absolute; }
#crosshair.firing { transform: translate(-50%,-50%) scale(1.3); }
/* 小地图 */
#minimap {
position: fixed; bottom: 20px; right: 20px;
width: 160px; height: 160px;
border: 2px solid #00ff88; border-radius: 8px;
z-index: 10; background: rgba(0,0,0,0.75);
}
/* 波次提示 */
#wave-notice {
position: fixed; top: 38%; left: 50%;
transform: translateX(-50%);
font-size: 48px; color: #ffaa00;
text-shadow: 0 0 20px #ffaa00;
font-weight: bold; opacity: 0;
transition: opacity 0.5s;
pointer-events: none; z-index: 50;
text-align: center; white-space: pre-line;
}
#boss-warning {
position: fixed; top: 35%; left: 50%;
transform: translateX(-50%);
font-size: 56px; color: #ff2200;
text-shadow: 0 0 30px #ff2200;
font-weight: bold; opacity: 0;
transition: opacity 0.4s;
pointer-events: none; z-index: 51;
text-align: center;
}
/* 伤害数字 */
.dmg-number {
position: fixed; font-weight: bold;
pointer-events: none; z-index: 60;
animation: floatUp 1s forwards;
font-size: 20px;
text-shadow: 0 0 6px currentColor;
}
@keyframes floatUp {
0% { opacity: 1; transform: translateY(0); }
100% { opacity: 0; transform: translateY(-60px); }
}
/* 击杀提示 */
#kill-feed {
position: fixed; top: 20px; right: 20px;
max-width: 220px; color: #ffaa00;
font-size: 14px; text-align: right;
z-index: 10; pointer-events: none;
}
.kill-item { animation: fadeOut 2.5s forwards; margin-bottom: 4px; }
@keyframes fadeOut {
0%,70% { opacity: 1; }
100% { opacity: 0; }
}
/* 受伤红色闪烁 */
#damage-flash {
position: fixed; inset: 0;
background: radial-gradient(ellipse at center, transparent 40%, rgba(255,0,0,0.5) 100%);
pointer-events: none; z-index: 9;
opacity: 0; transition: opacity 0.1s;
}
/* FPS */
#fps-display {
position: fixed; bottom: 20px; left: 20px;
color: rgba(255,255,255,0.35); font-size: 12px;
z-index: 10; poin.........完整代码请登录后点击上方下载按钮下载查看















网友评论0