LongJumpStart.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. const GameStatesStatic = require('GameStates');
  2. const StartLine = require('StartLine');
  3. cc.Class({
  4. extends:StartLine,
  5. properties: {
  6. },
  7. start () {
  8. // cc.log('x===='+this.node.convertToWorldSpaceAR(cc.Vec2.ZERO).x);
  9. var Hero = cc.find('Hero');
  10. // var Rivel = cc.find('Rivel');
  11. var HeroPlayerState = Hero.getComponent("PlayerState");
  12. // var RivelPlayerState = Rivel.getComponent("PlayerState");
  13. var data = {
  14. x : this.node.convertToWorldSpaceAR(cc.Vec2.ZERO).x,
  15. type : GameStatesStatic.GameProgress.LongJump
  16. };
  17. HeroPlayerState.StartLineStopPositionArray.push(data);
  18. // RivelPlayerState.StartLineStopPositionArray.push(this.node.convertToWorldSpaceAR(cc.Vec2.ZERO).x);
  19. },
  20. //跳远 开始起点
  21. onCollisionEnter: function (other)
  22. {
  23. this._super(other);
  24. if(other.node.name === 'PlayerCollisionLine')
  25. {
  26. cc.find('Canvas').getComponent('GameStates').CurrentProgress = GameStatesStatic.GameProgress.LongJump;
  27. cc.find('Canvas').getComponent('GameStates').strCureentLevel = 'LongJump';
  28. }
  29. },
  30. });