ConvertNumToTexture.js 647 B

1234567891011121314151617181920212223242526272829
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. },
  5. Test:function()
  6. {
  7. this.schedule(function () {
  8. this.ConvertNumToTexture(9);
  9. this.schedule(function () {
  10. this.ConvertNumToTexture(0);
  11. },1,0,0);
  12. },1,0,0);
  13. },
  14. start () {
  15. this.CurrentNum = 0;
  16. },
  17. ConvertNumToTexture:function(num)
  18. {
  19. this.node.setPosition(this.node.position.x-(num-this.CurrentNum)*41,this.node.position.y);
  20. var aSprite = this.node.getComponent(cc.Sprite);
  21. var FillStart = aSprite.fillStart = num/10;
  22. this.CurrentNum = num;
  23. }
  24. });