当前位置: 首页 > news >正文

邯郸网站建设渠道昆山设计网站公司

邯郸网站建设渠道,昆山设计网站公司,微信电脑网站是什么原因,装修全包报价明细表2023#xff08;待完善#xff0c;给玩家加上摄像机跟随效果#xff09; 1、stick监听cc.Node.EventType.TOUCH_MOVE事件#xff0c;获取tick移动的坐标和朝向#xff0c;限制移动的范围 2、根据stick的朝向#xff0c;每帧更新player的位置和方向 // 摇杆代码 joy_stick.jsc…待完善给玩家加上摄像机跟随效果 1、stick监听cc.Node.EventType.TOUCH_MOVE事件获取tick移动的坐标和朝向限制移动的范围 2、根据stick的朝向每帧更新player的位置和方向   // 摇杆代码 joy_stick.jscc.Class({extends: cc.Component,properties: {// foo: {// // ATTRIBUTES:// default: null, // The default value will be used only when the component attaching// // to a node for the first time// type: cc.SpriteFrame, // optional, default is typeof default// serializable: true, // optional, default is true// },// bar: {// get () {// return this._bar;// },// set (value) {// this._bar value;// }// },stick:{type: cc.Node,default: null},max_r : 80},// LIFE-CYCLE CALLBACKS: onLoad () {this.start_pos cc.v2(0, 0);this.stick.setPosition(this.start_pos);this.dir cc.v2(0, 0);this.stick.on(cc.Node.EventType.TOUCH_START, function(){}.bind(this), this);this.stick.on(cc.Node.EventType.TOUCH_MOVE, function(e){var w_pos e.getLocation();var pos this.node.convertToNodeSpaceAR(w_pos);var len pos.mag();/* 好处归一化一个方向只有一个值;this.dir.x cos(r);this.dir.y sin(r);// -1, 1*/this.dir.x pos.x / len;this.dir.y pos.y / len;if(len this.max_r){// 三角函数或者比例关系算坐标pos.x pos.x * this.max_r / len;pos.y pos.y * this.max_r / len;}this.stick.setPosition(pos);}.bind(this), this);this.stick.on(cc.Node.EventType.TOUCH_END, function(){this.dir cc.v2(0, 0);this.stick.setPosition(this.start_pos);}.bind(this), this);this.stick.on(cc.Node.EventType.TOUCH_CANCEL, function(){this.dir cc.v2(0, 0);this.stick.setPosition(this.start_pos);}.bind(this), this);},start () {},// update (dt) {}, });   // 玩家代码 player.jsvar joy_stick require(joy_stick); cc.Class({extends: cc.Component,properties: {stick : {default : null,type : joy_stick},speed : 80},// LIFE-CYCLE CALLBACKS:// onLoad () {}, start () {},update (dt) {if (this.stick.dir.mag() 0.5) {return;}var vx this.stick.dir.x * this.speed;var vy this.stick.dir.y * this.speed;this.node.x vx * dt;this.node.y vy * dt;// Math.atan2(y,x) 计算出来的结果angel是一个弧度值 数学的弧度是逆时针的 而游戏中是顺时针的var angel Math.atan2(this.stick.dir.y, this.stick.dir.x);var degree angel* 180 / Math.PI;degree 360 - degree 90;this.node.rotation degree;}, });  转载于:https://www.cnblogs.com/orxx/p/10652349.html
http://www.pierceye.com/news/95643/

相关文章:

  • 太原免费网站建设网站开发合作协议书
  • 深圳龙华做网站上海响应式网站制作公司
  • 招投标 网站建设专业型网站和个人网站
  • 网站建设需要那些基础增城线上教学
  • 专注移动网站建设免费咨询电脑维修
  • 六里桥做网站公司惠州做网站 百度优化
  • 做网站怎么选择上市公司wordpress 进销存
  • 做视频网站用哪个模板昆明贤邦网站建设
  • 自建网站工具wordpress仿内涵段子
  • 做推广最好的网站是哪个菜鸟网站建设
  • 首钢建设公司网站微信网站怎么做的好处
  • 西安网站开发费用网站即将 模板
  • 个人做商业网站需要什么热门网站建设代理
  • 企业网站手机端和pc端一个后台吗企业网站管理系统的运维服务
  • 北京官网开发优化游戏性能的软件
  • 网站开发选asp还是hph集约化网站群建设情况
  • 做网站域名重要吗10000ip网站怎么做
  • 途牛的旅游网站是谁做的wordpress 注册用户列表
  • 如何编辑网站新吁网站建设
  • 网站开发采集工具免费引流在线推广
  • 全面的锦州网站建设西安建筑工程有限公司
  • 做网站 郑州公司哪家好哪个购物网站最便宜
  • dedecms网站后台免费网页小游戏
  • 如何查网站外链wordpress火车头采集免费版
  • 四川住房建设和城乡建设厅新网站wordpress 采集 api
  • 企业所得税怎么交南昌seo实用技巧
  • 深圳英文网站开发企业网站和展板建设
  • 国内网站设计制作网页游戏传奇盛世开服表
  • 网站图片放大特效怎么做网站建设的后期服务要包括什么软件
  • 网站降权投诉商标注册证书电子版怎么查询