js实现完整种菜菜园偷菜游戏代码

代码语言:html

所属分类:游戏

代码描述:js实现完整种菜菜园偷菜游戏代码

代码标签: js 完整 种菜 菜园 偷菜 游戏 代码

下面为部分代码预览,完整代码请点击下载或在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>🌱 开心农场 - 偷菜游戏</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background: linear-gradient(135deg, #1a472a 0%, #2d5016 50%, #1a472a 100%);
            min-height: 100vh;
            overflow-x: hidden;
        }

        .game-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        /* 顶部状态栏 */
        .status-bar {
            background: linear-gradient(180deg, #8B4513 0%, #654321 100%);
            border: 4px solid #3d2817;
            border-radius: 15px;
            padding: 15px 25px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        }

        .player-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .avatar {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: linear-gradient(135deg, #FFD700, #FFA500);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 30px;
            border: 3px solid #fff;
            box-shadow: 0 3px 10px rgba(0,0,0,0.3);
        }

        .player-details h2 {
            color: #FFD700;
            font-size: 18px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }

        .player-details p {
            color: #90EE90;
            font-size: 14px;
        }

        .resources {
            display: flex;
            gap: 20px;
        }

        .resource {
            background: rgba(0,0,0,0.3);
            padding: 10px 20px;
            border-radius: 25px;
            display: flex;
            align-items: center;
            gap: 8px;
            color: #fff;
            font-weight: bold;
        }

        .resource-icon {
            font-size: 24px;
        }

        /* 导航按钮 */
        .nav-buttons {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .nav-btn {
            padding: 12px 25px;
            border: none;
            border-radius: 25px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .nav-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        }

        .nav-btn.my-farm {
            background: linear-gradient(135deg, #4CAF50, #45a049);
            color: white;
        }

        .nav-btn.friend-farm {
            background: linear-gradient(135deg, #2196F3, #1976D2);
            color: white;
        }

        .nav-btn.shop {
            background: linear-gradient(135deg, #FF9800, #F57C00);
            color: white;
        }

        .nav-btn.warehouse {
            background: linear-gradient(135deg, #9C27B0, #7B1FA2);
            color: white;
        }

        .nav-btn.active {
            transform: scale(1.05);
            box-shadow: 0 0 20px rgba(255,255,255,0.5);
        }

        /* 农场区域 */
        .farm-area {
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect fill="%234a7c23" width="100" height="100"/><circle fill="%23568f2a" cx="20" cy="30" r="15" opacity="0.5"/><circle fill="%23568f2a" cx="80" cy="70" r="20" opacity="0.5"/></svg>');
            background-color: #4a7c23;
            border: 5px solid #3d5c1a;
            border-radius: 20px;
            padding: 30px;
            box-shadow: inset 0 0 50px rgba(0,0,0,0.2), 0 10px 30px rgba(0,0,0,0.3);
        }

        .farm-title {
            text-align: center;
            color: #FFD700;
            font-size: 24px;
            margin-bottom: 20px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }

        .farm-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 15px;
            max-width: 800px;
            margin: 0 auto;
        }

        .plot {
            aspect-ratio: 1;
            background: linear-gradient(145deg, #5c4033, #3d2817);
            border: 4px solid #2a1a0a;
            border-radius: 15px;
            cursor: pointer;
            position: relative;
            transition: all 0.3s;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .plot:hov.........完整代码请登录后点击上方下载按钮下载查看

网友评论0