2048 JS代码


版权声明:本代码来自网络,版权归原博主所有,原博主地址:https://www.cnblogs.com/yidaixiaohui/p/8447637.html

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=0">

<title>使用JS实现2048小游戏</title>
<!-- 此处需要自己修改为自己的css路径  -->
<link rel="stylesheet" href="https://blog-static.cnblogs.com/files/chinakevin/reset.min.css">
<link rel="stylesheet" href="https://blog-static.cnblogs.com/files/chinakevin/style.css">

</head>
<body>

<header>
    <div class="container">
        <h1><span>2</span><span>0</span><span>4</span><span>8</span></h1>
    </div>
</header>

<div class="container">
    <div class="directions">
        <p><strong>如何玩:</strong> 使用你的箭头键移动瓷砖。当两个瓦片相互滑动时,它们合并成一个!</p>
    </div>
    <div class="scores">
        <div class="score-container best-score">
            最佳: 
            <div class="score">
                <div id="bestScore">0</div>
            </div>
        </div>
        <div class="score-container">
            分数: 
            <div class="score">
                <div id="score">0</div>
                <div class="add" id="add"></div>
            </div>
        </div>
    </div>
    <div class="game">
        <div id="tile-container" class="tile-container"></div>
        <div class="end" id="end">游戏结束<div class="monkey"></div><button class="btn not-recommended__item js-restart-btn" id="try-again">再试一次</button></div>
    </div>

    <div class="not-recommended">
        <button class="btn not-recommended__item js-restart-btn" id="restart">重新启动游戏</button>
    </div>

</div>
<!-- 此处需要自己修改JS路径 -->
<script src="https://blog-static.cnblogs.com/files/chinakevin/index.js"></script>

<div style="text-align:center;margin:10px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>
</body>
</html>
posted @ 2020-04-25 16:28  chinakevin  阅读(68)  评论(0编辑  收藏