登录 注册
当前位置:主页 > 资源下载 > 50 > CocosCreator实现左右跳游戏JumpLR.zip下载

CocosCreator实现左右跳游戏JumpLR.zip下载

  • 更新:2024-09-09 19:18:38
  • 大小:807KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:cocos2D - 游戏开发
  • 格式:ZIP

资源介绍

CocosCreator实现左右跳游戏JumpLR.zip const {ccclass, property} = cc._decorator; @ccclass export default class Box extends cc.Component { @property(cc.Label) txtNum: cc.Label = null; private mPrevBox: cc.Node = null; private mNextBox: cc.Node = null; private mOffset: number = 0; // [-4,4] // LIFE-CYCLE CALLBACKS: // onLoad () {} start () { } // update (dt) {} setOffset(offset: number){ this.mOffset = offset; } getOffset(){ return this.mOffset; } setPrev(prev: cc.Node){ this.mPrevBox = prev; } getPrev(){ return this.mPrevBox; } setNext(next: cc.Node){ this.mNextBox = next; } getNext(){ return this.mNextBox; } setNum(num: number){ this.txtNum.string = `${num}`; } down(y: number){ this.node.runAction(cc.sequence( cc.moveBy(0.4, 0, y), cc.callFunc( () => { NodeMgr.putBox(this.node); }) )); } }