three实现三维小人射击类人机对战游戏代码

代码语言:html

所属分类:游戏

代码描述:three实现三维小人射击类人机对战游戏代码,WASD 移动 ,鼠标点击自动瞄准射击

代码标签: three 三维 小人 射击 人机 对战 游戏 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>3D Tactical Duel - Fixed Shoot</title>
    <style>
        body { margin: 0; overflow: hidden; background: #1a1a1a; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; user-select: none; }
        
        /* UI 层 */
        #ui-layer {
            position: absolute;
            top: 0; left: 0; width: 100%; height: 100%;
            pointer-events: none;
        }

        /* HUD */
        .hud-panel {
            position: absolute;
            padding: 15px 25px;
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(5px);
            color: white;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.1);
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
            pointer-events: auto;
        }
        #score-panel { top: 20px; left: 20px; font-size: 20px; color: #ffcc00; }
        #round-info { top: 20px; right: 20px; font-size: 20px; text-align: right; }
        
        /* 准星 */
        #crosshair {
            position: absolute;
            width: 20px; height: 20px;
            border: 2px solid rgba(255, 255, 255, 0.8);
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            transition: width 0.1s, height 0.1s;
        }
        #crosshair.shooting { width: 30px; height: 30px; border-color: #ff4444; }

        /* 头顶血条 (由JS动态控制位置) */
        .hp-bar-wrap {
            position: absolute;
            width: 60px; height: 6px;
            background: #333;
            transform: translate(-50%, -50%);
            border: 1px solid #000;
            display: none;
        }
        .hp-bar-inner {
            height: 100%;
            background: #00ff00;
            width: 100%;
            transition: width 0.2s, background 0.2s;
        }

        /* 游戏结束/开始 弹窗 */
        #overlay {
            position: absolute;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.85);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            pointer-events: auto;
            z-index: 10;
        }
        h1 { color: white; font-size: 48px; margin-bottom: 10px; text-shadow: 0 0 10px.........完整代码请登录后点击上方下载按钮下载查看

网友评论0