All Projects → windlany → Wechat Weapp 2048

windlany / Wechat Weapp 2048

微信小程序-2048小游戏

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Wechat Weapp 2048

Wechat App Music
微信小程序:音乐播放器 技术栈: redux + es7 +labrador
Stars: ✭ 384 (-5.42%)
Mutual labels:  wechat-app, wechat
Nxdc Milktea
一套仿奈雪の茶小程序的前端模板
Stars: ✭ 198 (-51.23%)
Mutual labels:  wechat-app, wechat
Microsoft ai
人工智能实战微信小程序demo
Stars: ✭ 111 (-72.66%)
Mutual labels:  wechat-app, wechat
Wxapp Img Loader
适用于微信小程序的图片预加载组件
Stars: ✭ 1,049 (+158.37%)
Mutual labels:  wechat-app, wechat
Weapp
🐧 微信小程序组件和功能封装,基于微信Component自定义组件开发
Stars: ✭ 235 (-42.12%)
Mutual labels:  wechat-app, wechat
Supermarketmini
基于wepy2.x 仿苏宁小店小程序,API采用go开发(已开源),项目正在开发中,欢迎加群:160301726
Stars: ✭ 73 (-82.02%)
Mutual labels:  wechat-app, wechat
Wechat App Demo
📱微信小程序 demo
Stars: ✭ 1,678 (+313.3%)
Mutual labels:  wechat-app, wechat
Masterwechatapp
『微信小程序』优秀教程、轮子、开源项目 资源汇总
Stars: ✭ 826 (+103.45%)
Mutual labels:  wechat-app, wechat
Weapp Ssha
企业官网 小程序 源码
Stars: ✭ 233 (-42.61%)
Mutual labels:  wechat-app, wechat
Wxapp Scalc
💬微信小程序版简易计算器demo,适合入门练手
Stars: ✭ 230 (-43.35%)
Mutual labels:  wechat-app, wechat
Tom Vpr
how does voiceprint recognition work in wechat page
Stars: ✭ 37 (-90.89%)
Mutual labels:  wechat-app, wechat
Wechat Mini Shop
微信小程序商城,微信小程序微店,接口基于FaShop
Stars: ✭ 328 (-19.21%)
Mutual labels:  wechat-app, wechat
Mpvue Animated Number
微信小程序 mpvue 数字更新滚动动画组件 / An animated number component for mpvue
Stars: ✭ 33 (-91.87%)
Mutual labels:  wechat-app, wechat
Wechat Miniprogram Ar 3d
A WeChat MiniProgram 3D that includes a Panorama Viewer and a 3D Viewer using the device orientation control.
Stars: ✭ 80 (-80.3%)
Mutual labels:  wechat-app, wechat
Wechatmusicplayer
微信小程序:音乐播放器
Stars: ✭ 13 (-96.8%)
Mutual labels:  wechat-app, wechat
Rktk Wxx
软考题库微信小程序 ENJOY
Stars: ✭ 131 (-67.73%)
Mutual labels:  wechat-app, wechat
Python Weixin
微信(weixin|wechat) Python SDK 支持开放平台和公众平台 支持微信小程序云开发
Stars: ✭ 746 (+83.74%)
Mutual labels:  wechat-app, wechat
Weixin Java Miniapp Demo
基于Spring Boot 和 WxJava 实现的微信小程序Java后端Demo
Stars: ✭ 779 (+91.87%)
Mutual labels:  wechat-app, wechat
Wechat Weapp Grouputils
微信小程序群应用,包括群通知、群接龙、群投票、群通讯录4大功能
Stars: ✭ 222 (-45.32%)
Mutual labels:  wechat-app, wechat
Wepy Mall
微信小程序--基于wepy 商城(微店)微信小程序 欢迎学习交流
Stars: ✭ 3,224 (+694.09%)
Mutual labels:  wechat-app, wechat

2048

效果图

算法

该程序主要难度在用户滑动屏幕时值相同的cell合并 将空格标为0(我代码中是用的""表示空格),假设棋盘如下:

  • 0 2 0 2
  • 0 0 0 0
  • 0 0 0 2
  • 0 0 0 0

步骤

  • 通过touch相关的事件函数确定用户滑动方向
  • 将棋盘的数字生成4*4的二维数组list
  • 根据用户滑动方向生成四个小数组,比如用户将上面的棋盘向右滑动,则四个数组为:

item[0] = [2, 0, 2, 0]; item[1] = [0, 0, 0, 0]; item[2] = [2, 0, 0, 0]; // 注意是2000而不是0002,因为是向右滑动要从右边开始 item[3] = [0, 0, 0, 0];

  • 接下来就是滑动时合并,拿item[0]举例,如果是2020,向右滑动我们应该成为0004
  • 将item[0]的所有0移到末尾变为2200,遍历item将相同的下标值相加,后面的数置为0
  • 2020 ---> 2200 ---> 4200 ----> 4000
  • 如法炮制就可以实现滑动时合并
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].