1. 初识creator

1.官网下载安装cocos creator

2.运行

3.C:\CocosCreator\resources\cocos2d-x\simulator\win32   模拟器目录

4.新建空白项目

5.点击,进入项目目录

6.

7.在assets文件中新建文件夹

8. 新建脚本文件

扫描二维码关注公众号,回复: 5806187 查看本文章

分析模板代码

// Learn cc.Class:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
//自动生成的组件模板
//cc.Class()
cc.Class({

    //一个组件必须要继承自cc.Component
    extends: cc.Component,

    //属性,能够自动绑定到编辑器中
    properties: {
        // foo: {
        //     // ATTRIBUTES:
        //     default: null,        // The default value will be used only when the component attaching
        //                           // to a node for the first time
        //     type: cc.SpriteFrame, // optional, default is typeof default
        //     serializable: true,   // optional, default is true
        // },
        // bar: {
        //     get () {
        //         return this._bar;
        //     },
        //     set (value) {
        //         this._bar = value;
        //     }
        // },
        is_debug : false
    },

    // LIFE-CYCLE CALLBACKS:

    //组件加载时调用
    // onLoad () {},

    //节点开始运行的时候
    start () {
        console.log("Hello World123321");
    },

    //游戏每次刷新的时候,dt距离上一次更新的时间
    // update (dt) {},
});

猜你喜欢

转载自blog.csdn.net/qaz540411484/article/details/88930956