<学习分享>.手势识别

游戏中也会经常用到手势 于是我就想要做一个手势的例子 效果不错哦~
]


测试网站: 我是测试链接
步骤:1.找手势开源库 dollar.js
          2.学习cc.motionStreak
          3.绘制工程所需图片


思路:1.声明两个全局变量:pointsArray和dollar


          2.在init方法中对this.dollar 进行初始化 new DollarRecognizer();
             数组this.pointArray=[];
            创建一个cc.motionStreak来制做残影
            this._streak = cc.MotionStreak.create(3, 3, 64, cc.white(), s_streak);
            this.setTouchMode(1);//one by one


          3.在onTouchBegan中 
                 (1)把touch点 添加进pointsArray
                 (2)设置streak坐标 
                this._streak.setPosition(pos);
                 this._PointsArray.unshift(new Point(pos.x,pos.y));


         4.在onTouchMoved中做同样的事


         5.在onTouchEnd中
                 (1)把pointsArray添加进this._streak
                       var result=this._dollar.Recognize(this._PointsArray,1);
                (2)输出result字符 例如V。。。
                (3)对数组清空 pointsArray=[];
             
    
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值