phaser实现类似超级玛丽跳跃类游戏代码

代码语言:html

所属分类:游戏

代码描述:phaser实现类似超级玛丽跳跃类游戏代码

代码标签: phaser 类似 超级玛丽 跳跃 游戏 代码

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

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
<style>
    * {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: "Comic Sans MS","Arial",sans-serif;
    background: linear-gradient(to bottom,#ff9a56 0,#ff6b35 100%);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh
}

#gameContainer {
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    border-radius: 15px;
    overflow: hidden
}

#menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: rgba(255,154,86,0.95);
    padding: 40px;
    border-radius: 20px;
    border: 5px solid #8b4513;
    text-align: center;
    color: #fff;
    z-index: 1000;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    max-width: 500px
}

#menu h1 {
    font-size: 48px;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
    color: #fff
}

#menu .pumpkin-emoji {
    font-size: 64px;
    margin: 10px 0
}

#menu p {
    font-size: 18px;
    margin-bottom: 25px;
    line-height: 1.6;
    color: rgba(255,255,255,0.95)
}

#menu button {
    font-family: "Comic Sans MS","Arial",sans-serif;
    font-size: 24px;
    font-weight: bold;
    padding: 15px 40px;
    margin: 10px;
    background: #8b4513;
    color: white;
    border: 3px solid #5a2d0c;
    border-radius: 15px;
    cursor: pointer;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    transition: all .2s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2)
}

#menu button:hover {
    background: #a0522d;
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3)
}

#menu button:active {
    transform: scale(0.95)
}

.hidden {
    display: none!important
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-size: 20px;
    font-weight: bold;
    z-index: 100;
    pointer-events: none
}

#rotMeter {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 250px;
    z-index: 100;
    pointer-events: none
}

#rotMeter .label {
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px
}

#rotMeter .bar-container {
    background: rgba(0,0,0,0.5);
    border: 3px solid rgba(255,255,255,0.8);
    border-radius: 10px;
    padding: 5px;
    height: 35px
}

#rotMeter .bar {
    background: linear-gradient(to right,#f44,#fa0,#4f4);
    height: 100%;
    border-radius: 5px;
    transition: width .3s ease;
    box-shadow: 0 0 10px rgba(255,255,255,0.5)
}

#socialLinks {
    margin-top: 20px;
    font-size: 14px
}

#socialLinks a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    margin: 0 8px;
    transition: all .2s
}

#socialLinks a:hover {
    color: #fff;
    text-decoration: underline
}

#instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.4);
    font-size: 16px;
    text-align: center;
    z-index: 100;
    pointer-events: none
}

</style>
</head>

<body>
    <div id="gameContainer"></div>
    <div id="menu">
        <h1>DON'T LET ME ROT</h1>
        <p>
            You're a jack-o'-lantern racing against time!<br> Collect preservatives to stay fresh.<br> Avoid hazards that speed up decay.<br>
            <strong>How long can you survive?</strong>
        </p>
        <button id="startBtn">START ROTTING</button>
        <button id="howToPlayBtn">HOW TO PLAY</button>
        <button id="highScoresBtn">HIGH SCORES</button>


    </div>

    <div id="ui" class="hidden">
        <div>Score: <span id="scoreValue">0</span></div>
        <div>Level: <span id="levelValue">1</span></div>
        <div>Lives: <span id="livesValue">3</span></div>
    </div>

    <div id="rotMeter" class="hidden">
        <div class="label">Freshness</div>
        <div class="bar-container">
            <div class="bar" id="rotBar" style="width: 100%"></div>
        </div>
    </div>

    <div id="instructions" class="hidden">
        Arrow Keys or WASD to Move • Up or Space to Jump • Collect Ice Packs to Stay Fresh!
    </div>
<sc.........完整代码请登录后点击上方下载按钮下载查看

网友评论0