SpawnLine.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Learn cc.Class:
  2. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. LeavingPrintLocatoinLine: {
  14. default: null,
  15. type: cc.Prefab
  16. },
  17. SpawnPoint:{
  18. default: null,
  19. type: cc.Node
  20. },
  21. },
  22. onLoad(){
  23. this.HeroControl = this.SpawnPoint.getComponent('HeroControl');
  24. },
  25. spawnBlackLine:function(){
  26. let spawnLineTemp = null;
  27. spawnLineTemp = cc.instantiate(this.LeavingPrintLocatoinLine);
  28. spawnLineTemp.parent =this.SpawnPoint;
  29. spawnLineTemp.active = true;
  30. spawnLineTemp.setPosition(0, 0);
  31. }
  32. });