A free puzzle game — play it in your browser, no install. 原生 HTML、CSS 和 JavaScript 实现的 2048 网页小游戏,支持方向键操作、数字合并、分数记录与重新开始。
Made this, @WWL0924? See how many people played it → or use email
Controls: Arrow keys
GitHub may ask you to sign in, then to let VibeCruiser “Verify your GitHub identity” and “Act on your behalf”. We only read your profile and email, and never post anything.
Open the live demo Source on GitHub一个使用原生 HTML、CSS 和 JavaScript 编写的 2048 网页小游戏。玩家通过方向键移动数字方块,合并相同数字,并尽可能获得更高的分数。
使用键盘方向键(↑、↓、←、→)移动棋盘上的方块。 相同数字的方块相遇时会合并,合并后的数字为原数字的两倍。 每次移动后,棋盘会生成新的数字方块。 页面会显示当前已达到的最大方块数值。 棋盘没有空格,且相邻方块无法合并时,游戏结束;点击“再来一局”或“重新开始”按钮即可重开。
使用二维数组保存 4×4 棋盘中的方块数据。 使用 CSS Grid 布局绘制棋盘,并根据方块数值设置背景颜色。 通过方向键事件处理移动;上下左右的移动逻辑复用同一套左移与合并流程。 检查棋盘是否仍有空位或可合并的相邻方块,以判断游戏是否结束。 使用遮罩层展示结束状态,并通过重新初始化棋盘开始新的一局。
Built something like this? Submit your vibe — free account, takes a minute. How listing works.
Claim it: create a free account, then press CLAIM THIS in the cruiser. Put the badge below in your README or on your demo page first; that link is how we know it's yours.
Your project is on the cruise, loaded live from your own site. Put the badge in your README or on the demo page: it shows your live play count, it links back to this page, and everyone who lands here is one click from running the real thing.