(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/script/player.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, 'babb4w2d6BMDrqViu3ztZdM', 'player', __filename);
// script/player.ts
// 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
Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var Player = /** @class */ (function (_super) {
__extends(Player, _super);
function Player() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.label = null;
_this.text = 'hello';
_this.bullet = null;
return _this;
}
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
Player.prototype.start = function () {
var _this = this;
var self = this;
this.node.on(cc.Node.EventType.TOUCH_MOVE, function (event) {
self.node.setPosition(event.getLocation());
});
this.schedule(function () {
var bulleto = cc.instantiate(_this.bullet);
bulleto.setParent(cc.director.getScene());
bulleto.x = _this.node.x;
bulleto.y = _this.node.y + _this.node.height / 2 + 2;
}, 0.5); //定时器
cc.director.getCollisionManager().enabled = true;
};
Player.prototype.update = function (dt) {
//
};
Player.prototype.die = function () {
var _this = this;
cc.loader.loadRes("hero_die", cc.SpriteFrame, function (err, res) {
if (err) {
console.log(err);
return;
}
_this.getComponent(cc.Sprite).spriteFrame = res;
});
setTimeout(function () {
_this.node.destroy();
}, 300);
};
__decorate([
property(cc.Label)
], Player.prototype, "label", void 0);
__decorate([
property
], Player.prototype, "text", void 0);
__decorate([
property(cc.Prefab)
], Player.prototype, "bullet", void 0);
Player = __decorate([
ccclass
], Player);
return Player;
}(cc.Component));
exports.default = Player;
cc._RF.pop();
}
if (CC_EDITOR) {
__define(__module.exports, __require, __module);
}
else {
cc.registerModuleFunc(__filename, function () {
__define(__module.exports, __require, __module);
});
}
})();
//# sourceMappingURL=player.js.map
没有合适的资源?快使用搜索试试~ 我知道了~
cocos creater2.0 打飞机练习

共182个文件
json:92个
png:33个
meta:16个

需积分: 0 1 下载量 201 浏览量
2024-07-29
16:43:00
上传
评论
收藏 594KB ZIP 举报
温馨提示
cocos creater2.0 打飞机练习 typescript
资源推荐
资源详情
资源评论

























收起资源包目录





































































































共 182 条
- 1
- 2
资源评论


watson_pillow
- 粉丝: 15
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- linux常用命令大全.md
- linux常用命令大全.md
- 以繁中官网卡表为基础的宝可梦卡牌图像识别数据库+图形化查询工具
- linux常用命令大全.md
- 深度学习MATLAB实现基于BiGRU-Transformer双向门控循环单元(BiGRU)结合Transformer编码器进行多变量时序预测的详细项目实例(含模型描述及部分示例代码)
- linux常用命令大全.md
- k8s集群部署(脚本版)
- 遥感技术基于CNN-GRU-Attention的高光谱数据分类预测:融合空间光谱特征与注意力机制的深度学习模型设计及应用了文档的核心内容
- linux常用命令大全.md
- 能源领域MATLAB实现基于CNN-GRU卷积门控循环单元(CNN-GRU)进行锂电池剩余寿命预测的详细项目实例(含模型描述及部分示例代码)
- 【多变量时序预测】MATLAB实现基于CPO-BP-MOPSO冠豪猪优化算法(CPO)结合反向传播神经网络(BP)和多目标粒子群优化算法(MOPSO)进行多变量时序预测的详细项目实(含模型描述及部分示
- linux常用命令大全.md
- 《5种超炫纯CSS3动画按钮特效展示》
- linux常用命令大全.md
- SAP GUI 800-12 最新windows 64位客户端下载.rar
- 【深度学习与解释性AI】MATLAB实现基于DNN-SHAP深度神经网络(DNN)结合SHAP值方法(SHAP)进行多变量回归预测的详细项目实例(含模型描述及部分示例代码)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
