three+cannon实现三维小河搭桥让汽车通过游戏代码

代码语言:html

所属分类:游戏

代码描述:three+cannon实现三维小河搭桥让汽车通过游戏代码,选择木头并移动位置,在河上搭建一个木桥让汽车通过,两个木头之间用钉子固定,如果能让汽车通过就成功。

代码标签: three cannon 三维 小河 搭桥 汽车 通过 游戏 代码

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

<!DOCTYPE html>
<html lang="zh">
<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; font-family: 'Segoe UI', Arial, sans-serif; background: #1a1a2e; }
        canvas { display: block; }
        
        .panel {
            position: absolute;
            background: rgba(0,0,0,0.85);
            padding: 15px 20px;
            border-radius: 12px;
            color: white;
            border: 1px solid rgba(255,255,255,0.15);
            z-index: 100;
        }
        
        #infoPanel { top: 15px; left: 15px; }
        #infoPanel h3 { color: #4FC3F7; margin-bottom: 12px; font-size: 15px; }
        .stat { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; }
        .stat span:last-child { color: #4FC3F7; font-weight: bold; }
        
        .level-btns { display: flex; gap: 5px; margin-top: 12px; }
        .level-btn {
            flex: 1; padding: 8px; border: 2px solid #4FC3F7; border-radius: 6px;
            background: transparent; color: #4FC3F7; cursor: pointer; font-weight: bold;
        }
        .level-btn:hover, .level-btn.active { background: #4FC3F7; color: #000; }
        
        #helpPanel { top: 15px; right: 15px; font-size: 12px; color: #aaa; }
        #helpPanel h4 { color: #4FC3F7; margin-bottom: 8px; }
        #helpPanel p { margin: 4px 0; }
        
        #toolbar {
            position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
            display: flex; flex-direction: column; gap: 8px; z-index: 100;
        }
        .tool-btn {
            width: 65px; height: 65px; border: 2px solid rgba(255,255,255,0.3); border-radius: 12px;
            background: rgba(0,0,0,0.8); color: white; cursor: pointer;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            font-size: 10px; transition: all 0.2s;
        }
        .tool-btn:hover { border-color: #4FC3F7; background: rgba(79,195,247,0.2); }
        .tool-btn.active { border-color: #4CAF50; background: rgba(76,175,80,0.3); }
        .tool-btn .icon { font-size: 26px; margin-bottom: 3px; }
        
        #woodMenu {
            position: absolute; left: 90px; top: 50%; transform: translateY(-50%);
            background: rgba(0,0,0,0.9); padding: 15px; border-radius: 12px;
            border: 1px solid rgba(255,255,255,0.2); display: none; z-index: 100;
        }
        #woodMenu.show { display: block; }
        #woodMenu h4 { color: #4FC3F7; margin-bottom: 10px; font-size: 13px; }
        .wood-item {
            display: flex; align-items: center; gap: 12px; padding: 12px 15px; margin: 5px 0;
            background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
            border-radius: 8px; color: white; cursor: pointer; transition: all 0.2s;
        }
        .wood-item:hover { background: rgba(139,115,85,0.4); border-color: #8B7355; }
        .wood-bar { height: 14px; background: linear-gradient(90deg, #8B7355, #a08060); border-radius: 7px; }
        
        #editPanel {
            position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
            background: rgba(0,0,0,0.9); padding: 20px; border-radius: 12px;
            border: 1px solid rgba(255,255,255,0.2); display: none; min-width: 200px; z-index: 100;
        }
        #editPanel.show { display: block; }
        #editPanel h3 { color: #4CAF50; margin-bottom: 15px; font-size: 14px; }
        .edit-section { margin-bottom: 15px; }
        .edit-label { font-size: 11px; color: #888; margin-bottom: 8px; }
        .pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
        .pos-col { text-align: center; }
        .pos-col label { display: block; font-size: 11px; font-weight: bold; margin-bottom: 4px; }
        .pos-col.x label { color: #ff6b6b; }
        .pos-col.y label { color: #51cf66; }
        .pos-col.z label { color: #339af0; }
        .pos-btn {
            display: block; width: 100%; padding: 8px; margin: 2px 0; border: none; border-radius: 4px;
            background: rgba(255,255,255,0.1); color: white; cursor: pointer; font-size: 16px;
        }
        .pos-btn:hover { background: rgba(255,255,255,0.2); }
        .pos-val { font-size: 11px; color: #aaa; margin-top: 4px; }
        .rot-btns { display: flex; gap: 5px; }
        .rot-btn {
            flex: 1; padding: 10px 5px; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
            background: transparent; color: white; cursor: pointer; font-size: 11px;
        }
        .rot-btn:hover { background: rgba(255,255,255,0.1); }
        .del-btn {
            width: 100%; padding: 12px; border: none; border-radius: 8px;
            background: #e74c3c; color: white; cursor: pointer; font-weight: bold;
        }
        .del-btn:hover { background: #c0392b; }
        
        #bottomBar {
            position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
            display: flex; gap: 15px; z-index: 100;
        }
        .action-btn {
            padding: 14px 40px; font-size: 15px; font-weight: bold; border: none;
            border-radius: 25px; cursor: pointer; display: flex; align-items: center; gap: 8px;
        }
        .btn-test { background: linear-gradient(135deg, #4CAF50, #388E3C); color: white; }
        .btn-reset { background: linear-gradient(135deg, #ff5722, #e64a19); color: white; }
        .action-btn:hover { transform: translateY(-2px); }
        .action-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
  .........完整代码请登录后点击上方下载按钮下载查看

网友评论0