testNodeTouch.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. PlayerControlScript:null,
  5. },
  6. start () {
  7. this.touchClick();
  8. this.counttest = 1;//测试数据
  9. this.PlayerControlScript = cc.find('HeroControl').getComponent('PlayerControl');
  10. },
  11. touchClick: function () {
  12. // var TouchLayout = cc.find("TouchLayout");
  13. var self = this;
  14. self.node.on(cc.Node.EventType.TOUCH_START, function (event) {
  15. this.TOUCH_START(true);
  16. }.bind(this), self.node);
  17. self.node.on(cc.Node.EventType.TOUCH_MOVE, function (event) {
  18. this.TOUCH_MOVE(true);
  19. }.bind(this), self.node);
  20. self.node.on(cc.Node.EventType.TOUCH_END, function (event) {
  21. this.TOUCH_END(true);
  22. }.bind(this), self.node);
  23. },
  24. TOUCH_START:function () {
  25. // cc.log('TOUCH_START',this.counttest);
  26. this.PlayerControlScript.PlayerAnimControl.SpeedChange();//变速
  27. if(this.counttest<6){
  28. this.counttest++;
  29. }
  30. //以下为测试数据
  31. // this.PlayerControlScript.PlayerAnimControl.LongJumpUpToDown();//跳远
  32. // this.PlayerControlScript.PlayerAnimControl.SetArmatureName('Jav');
  33. // this.PlayerControlScript.PlayerAnimControl.JavelinFlyToDown();//标枪飞行
  34. // this.PlayerControlScript.PlayerAnimControl.ThrowJavelinOut();//扔标枪
  35. // this.PlayerControlScript.PlayerAnimControl.JumpOutElephant();//跳下大象
  36. this.PlayerControlScript.PlayerAnimControl.JumpToHurdle();//跨栏
  37. // this.PlayerControlScript.PlayerAnimControl.JumpOnElephant();//跳上大象
  38. },
  39. TOUCH_MOVE:function () {
  40. // cc.log('TOUCH_MOVE');
  41. },
  42. TOUCH_END:function () {
  43. // cc.log('TOUCH_END');
  44. },
  45. });