WriggleControl .js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const GameStatesStatic = require('GameStates');
  2. var BarrierSuperClass = require("BarrierSuper");
  3. cc.Class({
  4. extends: BarrierSuperClass,
  5. properties: {
  6. time : 2000
  7. },
  8. onLoad : function () {
  9. // this.tag = true;
  10. },
  11. onCollisionEnter: function (other)
  12. {
  13. if(other.node.name === 'PlayerCollisionLine')
  14. {
  15. // var Hero = cc.find("Hero");
  16. var HeroControl = other.node.parent.parent.getComponent("HeroControl");
  17. HeroControl.WriggleMove();
  18. // HeroControl.PlayerStateScript.CurrentSpeed = 100;
  19. // HeroControl.acceleration = 1000;
  20. // HeroControl.EnableHeroMoving(false);
  21. // cc.log("速度 减速 调用",other.node.parent.parent.name);
  22. }
  23. },
  24. onCollisionStay: function (other) {
  25. // console.log('on collision stay');
  26. },
  27. onCollisionExit: function (other) {
  28. },
  29. CollisionEnter: function (other)
  30. {
  31. if(other.node.name === 'PlayerCollisionLine')
  32. {
  33. // var Hero = cc.find("Hero");
  34. var HeroControl = other.node.parent.parent.getComponent("HeroControl");
  35. // HeroControl.WriggleMove(this.time);
  36. // cc.log("速度 减速 调用");
  37. }
  38. }
  39. });