HelloWorld.js 476 B

123456789101112131415161718192021222324
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. label: {
  5. default: null,
  6. type: cc.Label
  7. },
  8. // defaults, set visually when attaching this script to the Canvas
  9. text: 'Hello, World!'
  10. },
  11. // use this for initialization
  12. onLoad: function () {
  13. this.label.string = this.text;
  14. cc.log("你好,Cocos Creator")
  15. },
  16. // called every frame
  17. update: function (dt) {
  18. },
  19. });