RoleAnimationCtrl.js 1014 B

123456789101112131415161718192021222324252627282930313233
  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. role: sp.Skeleton,
  14. },
  15. onLoad() {
  16. this.node.on(cc.Node.EventType.TOUCH_END, () => {
  17. this.role.setAnimation(0, 'click', false);
  18. this.role.setCompleteListener(()=>{
  19. this.role.setAnimation(0, 'stand', true);
  20. })
  21. }, this);
  22. },
  23. start() {
  24. },
  25. // update (dt) {},
  26. });