53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import ResourcesManager from "./core/ResourcesManager";
|
|
|
|
// Learn TypeScript:
|
|
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html
|
|
// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
|
|
// - [English] http://www.cocos2d-x.org/docs/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] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class Test extends cc.Component {
|
|
|
|
|
|
@property({type:cc.Texture2D})
|
|
private tex:cc.Texture2D = null;
|
|
|
|
@property(cc.Node)
|
|
private tail:cc.Node = null;
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {}
|
|
|
|
start () {
|
|
|
|
|
|
|
|
|
|
//this.getComponent(cc.Animation).play("splash");
|
|
//this.getComponent(cc.Animation).stop();
|
|
|
|
//this.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(this.tex,new cc.Rect(0,0,100,100),true,cc.v2(0,0),new cc.Size(100,100));
|
|
|
|
|
|
//this.getComponent(cc.Sprite).spriteFrame.setTexture(this.tex,new cc.Rect(50,50,100,100))
|
|
//this.getComponent(cc.Sprite).spriteFrame.setRect(new cc.Rect(0,0,100,100))
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
update (dt)
|
|
{
|
|
this.tail.x += 100 * dt;
|
|
}
|
|
}
|