three实现三维隧道避障游戏代码

代码语言:html

所属分类:游戏

代码描述:three实现三维隧道避障游戏代码。gemini3生成

代码标签: three 三维 隧道 避障 游戏 代码

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hexagon Tunnel Runner 3D</title>
<style>
        body { margin: 0; overflow: hidden; background-color: #000; color: white; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
        
        /* Global reset for tap highlight and selection */
        * {
            -webkit-tap-highlight-color: transparent !important;
            -webkit-touch-callout: none !important;
        }
        
        #hud-top {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            padding: 20px;
            box-sizing: border-box;
            display: flex;
            justify-content: space-between;
            pointer-events: none; /* Click through */
        }

        .hud-panel {
            background: rgba(0, 20, 40, 0.7);
            border: 1px solid #00ffff;
            padding: 15px 25px;
            border-radius: 4px;
            backdrop-filter: blur(4px);
            box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
        }

        .hud-label {
            font-size: 12px;
            color: #00aaaa;
            text-transform: uppercase;
            letter-spacing: 2px;
            margin-bottom: 5px;
            display: block;
        }

        .hud-value {
            font-size: 32px;
            font-weight: 800;
            color: #fff;
            text-shadow: 0 0 10px #00ffff;
            font-family: 'Courier New', Courier, monospace;
        }

        #score-container {
            display: none;
        }

        #game-over {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            display: none;
            background: rgba(0, 0, 0, 0.9);
            border: 2px solid #ff0000;
            padding: 40px;
            box-shadow: 0 0 50px rgba(255, 0, 0, 0.5);
            z-index: 100;
        }

        h1 { font-size: 64px; color: #ff0000; text-shadow: 0 0 20px #ff0000; margin: 0 0 20px 0; letter-spacing: 4px; }
        
        p { font-size: 24px; margin-bottom: 30px; color: #fff; }

        button {
            background: rgba(255, 0, 0, 0.2);
            border: 2px solid #ff0000;
            color: #ff0000;
            padding: 15px 40px;
            font-size: 24px;
            cursor: pointer;
            font-family: inherit;
            text-transform: uppercase;
            letter-spacing: 2px;
            transition: all 0.3s;
        }
        button:hover { 
            background: #ff0000; 
            color: #000; 
            box-shadow: 0 0 30px #ff0000;
        }

        #instructions {
            position: absolute;
            bottom: 30px;
            width: 100%;
            text-align: center;
            color: #00aaaa;
            font-size: 14px;
            letter-spacing: 2px;
            text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
        }
        #mobile-controls {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 50%; /* Bottom half of screen */
            display: flex;
            pointer-events: none; /* Let clicks pass through to game if needed, but buttons will capture */
            z-index: 50;
        }

        .control-btn {
            flex: 1;
            height: 100%;
            background: rgba(0, 255, 255, 0.0);
            border: none;
            outline: none !important;
            -webkit-tap-highlight-color: transparent !important;
            user-select: none;
            -webkit-user-select: none;
            -webkit-touch-callout: none;
            pointer-events: auto;
            touch-action: none; /* Disable browser handling of gestures */
            position: relative;
            cursor: pointer;
            display: flex;
            justify-content: center;
            align-items: flex-end;
            padding-bottom: 40px;
            box-sizing: border-box;
        }
        
        .control-btn:focus, .control-btn:active {
            outline: none !important;
            background: rgba(0, 255, 255, 0.0); /* Prevent background change on focus if unwanted */
        }
        
        /* Visual indicator for touch zones (optional, maybe just arrows) */
        .control-btn::after {
            content: '';
            width: 60px;
            height: 60px;
            border: 2px solid rgba(0, 255, 255, 0.3);
            border-radius: 50%;
            background: rgba(0, 20, 40, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            color: #00ffff;
            backdrop-filter: blur(2px);
        }

        #btn-left::after {
            content: '<';
        }

        #btn-right::after {
            content: '>';
        }

        .control-btn:active {
            background: rgba(0, 255, 255, 0.1);
        }
        .control-btn:active::after {
            background: rgba(0, 255, 255, 0.2);
            transform: scale(1.1);
        }
        #pause-btn {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            width: 50px;
            height: 50px;
            background: rgba(0, 0, 0, 0.8);
            border: 2px solid #00ffff;
            border-radius: 0;
            color: #00ffff;
            font-size: 20px;
            font-weight: bold;
            cursor: pointer;
            z-index: 100;
            display: flex;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(4px);
            box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
            pointer-events: auto;
            transition: all 0.2s;
        }
        #pause-btn:hover {
            background: #00ffff;
            c.........完整代码请登录后点击上方下载按钮下载查看

网友评论0