js+css实现儿童小学生语文汉字保卫战游戏代码

代码语言:html

所属分类:游戏

代码描述:js+css实现儿童小学生语文汉字保卫战游戏代码

代码标签: js css 儿童 小学生 语文 汉字 保卫战 游戏 代码

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

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>功夫熊猫:汉字大保卫战</title>
    <style>
        /* --- 基础设定 --- */
        :root {
            --bg-color: #70d6ff;
            --grass-color: #99e2b4;
            --ui-bg: rgba(255, 255, 255, 0.95);
            --font-cartoon: "YouYuan", "Modak", "Hanyi", cursive, sans-serif;
            --player-hp: #ff4757;
            --enemy-hp: #2f3542;
        }

        body {
            margin: 0;
            padding: 0;
            font-family: var(--font-cartoon);
            background: linear-gradient(to bottom, var(--bg-color) 60%, var(--grass-color) 60%);
            height: 100vh;
            overflow: hidden;
            user-select: none;
            touch-action: manipulation;
        }

        /* --- 游戏舞台 --- */
        #stage {
            position: relative;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        /* --- 顶部UI (血条) --- */
        .hud {
            padding: 10px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(0,0,0,0.1);
        }

        .hp-container {
            width: 40%;
            position: relative;
        }

        .hp-label {
            font-size: 14px;
            color: #fff;
            margin-bottom: 5px;
            text-shadow: 1px 1px 2px #000;
        }

        .hp-bar {
            height: 20px;
            background: #444;
            border-radius: 10px;
            border: 2px solid #fff;
            overflow: hidden;
        }

        .hp-fill {
            height: 100%;
            width: 100%;
            transition: width 0.5s ease-out;
        }

        #player-hp-fill { background: #2ed573; }
        #enemy-hp-fill { background: #ff4757; }

        .vs-logo {
            font-size: 30px;
            font-weight: bold;
            color: #fff;
            text-shadow: 2px 2px 0 #000;
            animation: pulse 1s infinite;
        }

        /* --- 角色区域 --- */
        .battle-ground {
            flex: 1;
            position: relative;
            display: flex;
            justify-content: space-around;
            align-items: flex-end;
            padding-bottom: 220px; /* 留出题目区域 */
        }

        /* CSS 功夫熊猫 */
        .hero {
        .........完整代码请登录后点击上方下载按钮下载查看

网友评论0