哈喽!大家好,我是HappyGirl快乐女孩,最爱海贼王💞💞💞
是一位爱好技术的【技术Fans】!😜😜😜💞💞💞 如果有对技术感兴趣的宅友,欢迎关注💞💞💞
❤️❤️❤️感谢各位❤️❤️❤️
————————————————
🎒 🎒 🎒 文章目录 🎒 🎒 🎒
目录
🏳️🌈 介绍
2014年Gabriele Cirulli利用周末的时间写2048这个游戏的程序,仅仅只是好玩而已。他想用一种不同的视觉展现效果和更快速的动画来创造属于自己的游戏版本。
每次可以选择上下左右其中一个方向去滑动,每滑动一次,所有的数字方块都会往滑动的方向靠拢外,系统也会在空白的地方乱数出现一个数字方块,相同数字的方块在靠拢、相撞时会相加。不断的叠加最终拼凑出2048这个数字就算成功。
这里通过微信小程序开发这这款小游戏
🍁 玩法截图
📣 部分源码
//app.js const GLOBAL_DATA_SAVE_KEY = '__gloabl_data__' App({ onLaunch: function() { let data = wx.getStorageSync(GLOBAL_DATA_SAVE_KEY) if (data) { this.globalData = data // console.log(this) } else { let that = this wx.downloadFile({ url: 'https://fanqier.com/static/merge1.silk', success(res) { if (res.tempFilePath) { that.globalData.merge = res.tempFilePath wx.saveFile({ tempFilePath: res.tempFilePath, success: function(res) { that.globalData.merge = res.savedFilePath wx.setStorage({ key: GLOBAL_DATA_SAVE_KEY, data: that.globalData }) console.log(res) } }) } } }) wx.downloadFile({ url: 'https://fanqier.com/static/move1.silk', success(res) { if (res.tempFilePath) { that.globalData.move = res.tempFilePath wx.saveFile({ tempFilePath: res.tempFilePath, success: function(res) { that.globalData.move = res.savedFilePath wx.setStorage({ key: GLOBAL_DATA_SAVE_KEY, data: that.globalData }) console.log(res) } }) } } }) } }, globalData: { merge: '', move: '', } })
💞 完整源码链接
2048小游戏微信小程序源码.rar-小程序文档类资源-CSDN文库
各位走过路过,不要错过,记得关注我哦
- 海报