(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/script/game/miner.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, 'ab864fWm3hCPbT+oWZt7sIq', 'miner', __filename);
// script/game/miner.js
'use strict';
var initObj = require('initObj');
var player = initObj.player;
cc.Class({
extends: cc.Component,
properties: {
gameNode: {
default: null,
type: cc.Node
},
ropeNode: {
default: null,
type: cc.Node
},
clawNode: {
default: null,
type: cc.Node
},
claw0Node: {
default: null,
type: cc.Node
},
claw1Node: {
default: null,
type: cc.Node
}
},
onLoad: function onLoad() {
this.animation = this.node.getComponent(cc.Animation);
this.game = this.gameNode.getComponent('game');
this.rope = this.ropeNode.getComponent('rope');
this.claw = this.clawNode.getComponent('claw');
this.claw0 = this.claw0Node.getComponent('claw0');
this.claw1 = this.claw1Node.getComponent('claw1');
},
init: function init() {
this.texture = this.getComponent(cc.Sprite).spriteFrame;
this.minerToRight();
},
minerToRight: function minerToRight() {
var delay = 1;
var minerAction = cc.moveTo(delay, cc.p(0, initObj.miner.position.y));
this.node.setPosition(initObj.miner.position);
this.node.runAction(minerAction);
this.animation.play('miner-appear');
this.scheduleOnce(function () {
this.animation.stop();
this.getComponent(cc.Sprite).spriteFrame = this.texture;
this.ropeRotate();
this.game.gameRun();
}, delay, this);
},
minerToleft: function minerToleft() {
var finished = cc.callFunc(function (target) {
this.animation.stop();
this.game.goNext();
}, this);
var minerAction = cc.moveTo(1.5, initObj.miner.position);
this.node.runAction(cc.sequence(minerAction, finished));
},
getAnimation: function getAnimation(speed) {
this.animationType = 'miner-pull-' + speed.type;
this.animation.play(this.animationType);
this.getSpeend = speed.numb;
},
ropeRotate: function ropeRotate() {
var rope = this.ropeNode;
var rote = 75;
var drictive = 1;
var y = this.clawNode.y;
var height = this.ropeNode.height;
var hasPause = false;
var endAnimation = false;
this.state = 'rotate';
this.callback = function () {
if (!player.isgamerun()) {
if (this.state == 'rotate') {
player.preMoney = 0;
this.minerToleft();
this.unschedule(this.callback);
} else {
if (!endAnimation) {
this.clawOpen();
this.claw.objHide();
this.state = 'up';
this.animation.stop();
this.getAnimation(initObj.fastSpeed);
this.animation.play(this.animationType);
endAnimation = true;
}
up.call(this);
}
} else {
if (!player.pause) {
switch (this.state) {
case 'down':
down.call(this);
break;
case 'up':
if (hasPause) {
this.animation.play(this.animationType);
hasPause = false;
}
up.call(this);
break;
default:
roate.call(this);
}
} else {
if (this.state == 'up') {
this.animation.pause();
hasPause = true;
}
}
}
};
this.schedule(this.callback, 0.01);
function up() {
var speend = this.getSpeend;
this.ropeNode.height -= speend;
this.clawNode.y += speend;
if (this.clawNode.y >= y) {
this.state = 'rotate';
this.clawNode.y = y;
this.ropeNode.height = height;
this.animation.stop();
this.getComponent(cc.Sprite).spriteFrame = this.texture;
this.clawOpen();
this.game.minerUp();
}
}
function down() {
var speend = 10;
this.ropeNode.height += speend;
this.clawNode.y -= speend;
}
function roate() {
rope.rotation += drictive;
if (rope.rotation > rote) {
drictive = -1;
}
if (rope.rotation < -rote) {
drictive = 1;
}
}
},
clawOpen: function clawOpen() {
var action1 = cc.rotateTo(0.2, 0);
var action2 = cc.rotateTo(0.2, 0);
this.claw0Node.runAction(action1);
this.claw1Node.runAction(action2);
},
clawClose: function clawClose() {
var action1 = cc.rotateTo(0.1, -15);
var action2 = cc.rotateTo(0.1, 15);
this.claw0Node.runAction(action1);
this.claw1Node.runAction(action2);
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});
cc._RF.pop();
}
if (CC_EDITOR) {
__define(__module.exports, __require, __module);
}
else {
cc.registerModuleFunc(__filename, function () {
__define(__module.exports, __require, __module);
});
}
})();
//# sourceMappingURL=miner.js.map
没有合适的资源?快使用搜索试试~ 我知道了~
黄金矿工源码
共690个文件
json:436个
meta:75个
png:45个
需积分: 50 27 下载量 98 浏览量
2019-05-07
14:49:23
上传
评论 2
收藏 13.88MB ZIP 举报
温馨提示
黄金矿工源码,cocoscreator,仅供学习参考使用,可以直接运行
资源推荐
资源详情
资源评论
收起资源包目录
黄金矿工源码 (690个子文件)
miner-pull-heavy.anim 2KB
miner-pull-light.anim 1KB
miner-pull-fast.anim 1KB
miner-appear.anim 1KB
miner-thorw.anim 950B
miner_face.anim 773B
miner_leg.anim 772B
cave.anim 769B
obj-gold2.anim 748B
obj-gold1.anim 623B
buffer.bin 157KB
a579b610-0aa7-4a8b-b36b-be34cc834dcc.bin 157KB
83f5eff8-3385-4f95-9b76-8da0aa1d96cd.bin 48KB
14c74869-bdb4-4f57-86d8-a7875de2be30.bin 46KB
3bbdb0f6-c5f6-45de-9f33-8b5cbafb4d6d.bin 46KB
b430cea3-6ab3-4106-b073-26c698918edd.bin 7KB
a1ef2fc9-9c57-418a-8f69-6bed9a7a0e7f.bin 5KB
7a17de6e-227a-46b1-8009-e7157d4d3acf.bin 4KB
046f172c-1574-488b-bbb8-6415a9adb96d.bin 840B
e93d3fa9-8c21-4375-8a21-14ba84066c77.bin 140B
index.fire 50KB
LeaveScene.fire 49KB
.gitignore 1KB
eb5df8da8db4d7869d6edf04a1a286bd.gltf 19KB
cadb09da-8d20-4a29-b960-529709259a69.jpg 125KB
shop-background.jpg 125KB
0e067114-0e37-4d62-b785-0051648c3a1b.jpg 82KB
level-background-0.jpg 82KB
790cd7f3-cd1a-4b87-9033-24e9b5404800.jpg 47KB
level-background-1.jpg 47KB
e5e3649b-e4cd-4aab-8f94-d92ce3f4d3d1.jpg 31KB
menu-background-sky.jpg 31KB
miner.js 6KB
ab8647d6-9b78-423d-b4fe-a1666deec22a.js 6KB
miner.js 5KB
menu.js 5KB
config.js 5KB
8697f210-33f9-4390-aec6-cfb6ca2ad014.js 5KB
menu.js 4KB
779856f0-5836-46fa-9ba4-065e814fa8dd.js 4KB
game.js 4KB
config.js 3KB
index.js 3KB
a9d2aee0-eff4-48e9-a97f-d8f79cab481a.js 3KB
game.js 3KB
state.js 3KB
a221dbb7-3af3-4376-8b8d-352787299ad9.js 3KB
index.js 3KB
f3c4a754-3c8e-434e-b801-8019548ea1a5.js 2KB
claw.js 2KB
ButtonScaler.js 2KB
state.js 2KB
obj.js 2KB
c0965a4a-fc59-4519-a5b5-c21fbc0a7fa7.js 1KB
levelover.js 1KB
bg.js 1KB
claw.js 1KB
23d4c45d-a826-4d38-8445-457560d6e3cb.js 1KB
initObj.js 1KB
3ebbafe8-777e-4b49-ad62-519b5fec2834.js 1KB
ButtonScaler.js 1KB
obj.js 934B
6e262885-1ff7-44b5-b873-005b8219d585.js 719B
5529b00b-6b73-404e-9f18-b96334991f7f.js 584B
levelover.js 567B
89be71ab-6e19-4d77-976f-3bf78ced90a4.js 510B
bg.js 441B
initObj.js 358B
acc86b0f-f698-4933-be49-eaeb1690c335.json 50KB
bb050e90-9b8b-45d2-aeb2-6efb9f875e29.json 49KB
abc2cb62-7852-4525-a90d-d474487b88f2.json 30KB
uuid-to-mtime.json 23KB
d1b8be49-b0a0-435c-83b7-552bed4bbe35.json 20KB
bf0a434c-84dd-4a8e-a08a-7a36f180cc75.json 20KB
ca8401fe-ad6e-41a8-bd46-8e3e4e9945be.json 15KB
ab2fdde9-10c2-44e4-bfe1-fcfcc1a86aa9.json 14KB
79eafaef-b7ef-45d9-9c3f-591dc836fc7a.json 13KB
6d91e591-4ce0-465c-809f-610ec95019c6.json 13KB
430eccbf-bf2c-4e6e-8c0c-884bbb487f32.json 13KB
32044bd2-481f-4cf1-a656-e2b2fb1594eb.json 12KB
115286d1-2e10-49ee-aab4-341583f607e8.json 12KB
193b0e71-8662-4191-a417-3b851828717d.json 11KB
61aeb05b-3b32-452b-8eed-2b76deeed554.json 9KB
b9041e82-76a4-4c73-bbd1-8083c18cbeb0.json 7KB
972b9a4d-47ee-4c74-b5c3-61d8a69bc29f.json 7KB
0004d1cf-a0ad-47d8-ab17-34d3db9d35a3.json 7KB
0d784963-d024-4ea6-a7db-03be0ad63010.json 6KB
services.json 5KB
5965ffac-69da-4b55-bcde-9225d0613c28.json 4KB
0e93aeaa-0b53-4e40-b8e0-6268b4e07bd7.json 3KB
2874f8dd-416c-4440-81b7-555975426e93.json 3KB
7f52aab3-0c95-400f-a80c-8a836dbfe81c.json 3KB
fc1c3b59-84c7-42db-99e4-db5c6904c9b0.json 3KB
009b60c7-5fd4-4637-ba83-ca12f4a01bd4.json 3KB
cd33edea-55f5-46c2-958d-357a01384a36.json 3KB
954fec8b-cd16-4bb9-a3b7-7719660e7558.json 3KB
2cb8acd8-d091-4a4b-b416-4765000acd42.json 3KB
6c5cf6e1-b044-4eac-9431-835644d57381.json 3KB
785a442c-3ceb-45be-a46e-7317f625f3b9.json 3KB
66e77ee8-8b98-47f5-bded-e814f4ea9c92.json 3KB
共 690 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
来了,老弟。
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功