RideBikeStart.js 1.2 KB

123456789101112131415161718192021222324252627282930
  1. const StartLine = require('StartLine');
  2. const GameStatesStatic = require('GameStates');
  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. // HeroPlayerState.StartLineStopPositionArray.push(this.node.convertToWorldSpaceAR(cc.Vec2.ZERO).x);
  19. // RivelPlayerState.StartLineStopPositionArray.push(this.node.convertToWorldSpaceAR(cc.Vec2.ZERO).x);
  20. },
  21. //跳远 开始起点
  22. onCollisionEnter: function (other)
  23. {
  24. this._super(other);
  25. cc.find('Canvas').getComponent('GameStates').CurrentProgress = GameStatesStatic.GameProgress.LongJump;
  26. cc.find('Canvas').getComponent('GameStates').strCureentLevel = 'RideBike';
  27. },
  28. });