Commit 3a5a2084 authored by linzhiguo's avatar linzhiguo

# 连击正确选项

parent 18bffb4e
...@@ -4849,7 +4849,7 @@ ...@@ -4849,7 +4849,7 @@
"__id__": 97 "__id__": 97
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 100 "__id__": 100
...@@ -5065,7 +5065,7 @@ ...@@ -5065,7 +5065,7 @@
"__id__": 102 "__id__": 102
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 105 "__id__": 105
......
...@@ -236,10 +236,6 @@ cc.Class({ ...@@ -236,10 +236,6 @@ cc.Class({
for(let i = 0; i < 2; i ++){ for(let i = 0; i < 2; i ++){
let pos = this.flyPositions[i].convertToWorldSpaceAR(cc.v2(0,0)); let pos = this.flyPositions[i].convertToWorldSpaceAR(cc.v2(0,0));
let pos1 = bg.convertToNodeSpaceAR(cc.v2(pos.x, pos.y)) let pos1 = bg.convertToNodeSpaceAR(cc.v2(pos.x, pos.y))
console.log(pos);
console.log(pos1);
this.flys[i]._x = pos1.x; this.flys[i]._x = pos1.x;
this.flys[i]._y = pos1.y; this.flys[i]._y = pos1.y;
} }
...@@ -285,16 +281,20 @@ cc.Class({ ...@@ -285,16 +281,20 @@ cc.Class({
this._touched = false; this._touched = false;
playDragonBoneAnimation(this._flyswatter.children[0], 'normal'); playDragonBoneAnimation(this._flyswatter.children[0], 'normal');
item._dizzy_ani = cc.tween(this._flyswatter) item._dizzy_ani = cc.tween(this._flyswatter)
.delay(0.2) //.delay(0.2)
.call(()=>{ .call(()=>{
this.cleanTimer();
if (item._recount_timer){
item._recount_timer.stop();
item._recount_timer = null;
}
if (i != this._correct_index){ if (i != this._correct_index){
console.log('hit err');
playDragonBoneAnimation(item, 'dizzy', 1, ()=>{ playDragonBoneAnimation(item, 'dizzy', 1, ()=>{
playDragonBoneAnimation(item, 'normal', -1); playDragonBoneAnimation(item, 'normal', -1);
}); });
if (item._recount_timer){
item._recount_timer.stop();
item._recount_timer = null;
}
item._recount_timer = cc.tween(this._time_node) item._recount_timer = cc.tween(this._time_node)
.delay(1) .delay(1)
.call(()=>{ .call(()=>{
...@@ -303,6 +303,9 @@ cc.Class({ ...@@ -303,6 +303,9 @@ cc.Class({
.start(); .start();
} }
else{ else{
console.log('hit ok');
this._can_hitted = false;
this.fallCare(); this.fallCare();
} }
}) })
...@@ -329,6 +332,10 @@ cc.Class({ ...@@ -329,6 +332,10 @@ cc.Class({
}, },
startItem(){ startItem(){
if (this._finished == true){
return;
}
this._sound_button._sprite.active = true; this._sound_button._sprite.active = true;
let item = this.data[this._index]; let item = this.data[this._index];
...@@ -532,12 +539,18 @@ cc.Class({ ...@@ -532,12 +539,18 @@ cc.Class({
this.unitedFontSize(this.flyVirus, 240, 64); this.unitedFontSize(this.flyVirus, 240, 64);
for(let i = 0; i < 2; i++){ for(let i = 0; i < 2; i++){
this.virusOks[i].active = true; if (this.flys[i]._fall_ani != null){
this.flys[i]._fall_ani.stop();
this.flys[i]._fall_ani = null;
}
this.flys[i].x = this.flys[i]._x + this._frameSize.width * 1.5;
this.flys[i].y = this.flys[i]._y;
this.virusOks[i].active = true;
this.unitedFontSize(this.virusOks, 240, 64); this.unitedFontSize(this.virusOks, 240, 64);
this.virusOks[i].active = false; this.virusOks[i].active = false;
this.fallVirus[i].active = true; this.fallVirus[i].active = true;
this.unitedFontSize(this.fallVirus, 240, 64); this.unitedFontSize(this.fallVirus, 240, 64);
this.fallVirus[i].active = false; this.fallVirus[i].active = false;
} }
cc.tween(this.flys[0]) cc.tween(this.flys[0])
...@@ -556,6 +569,7 @@ cc.Class({ ...@@ -556,6 +569,7 @@ cc.Class({
flyOut(){ flyOut(){
this._sound_button._sprite.active = false; this._sound_button._sprite.active = false;
this._can_hitted = false; this._can_hitted = false;
this.cleanTimer();
for(let i = 0; i < 2; i++){ for(let i = 0; i < 2; i++){
this.flyVirus[i].active = false; this.flyVirus[i].active = false;
...@@ -606,19 +620,31 @@ cc.Class({ ...@@ -606,19 +620,31 @@ cc.Class({
}, },
fallCare(){ fallCare(){
this.cleanTimer();
this._can_hitted = false; this._can_hitted = false;
this.updateFlag(); this.updateFlag();
let fly; let fly;
for(let i = 0; i < 2; i++){ for(let i = 0; i < 2; i++){
fly = this.flys[i]; fly = this.flys[i];
if (fly._recount_timer){
fly._recount_timer.stop();
fly._recount_timer = null;
}
if (i == this._correct_index){ if (i == this._correct_index){
playDragonBoneAnimation(fly, 'dizzy', -1); playDragonBoneAnimation(fly, 'dizzy', -1);
cc.tween(fly) fly._fall_ani = cc.tween(fly)
.to(1, {y: fly._x - this._frameSize.height*1.5}) .to(1, {y: fly._x - this._frameSize.height*1.5})
.call(()=>{
fly.x = fly._x + this._frameSize.height*1.5;
fly.y = fly._y;
})
.start(); .start();
continue; continue;
} }
playDragonBoneAnimation(fly, 'scare', -1); playDragonBoneAnimation(fly, 'scare', -1);
cc.tween(fly) cc.tween(fly)
.to(1, {x: fly._x - this._frameSize.width * 1.5}) .to(1, {x: fly._x - this._frameSize.width * 1.5})
...@@ -628,7 +654,7 @@ cc.Class({ ...@@ -628,7 +654,7 @@ cc.Class({
cc.tween(this._time_node) cc.tween(this._time_node)
.delay(1) .delay(1)
.call(()=>{ .call(()=>{
this.cleanTimer();
for(let i = 0; i < 2; i++){ for(let i = 0; i < 2; i++){
this.flys[i].x = this.flys[i]._x + this._frameSize.width * 1.5; this.flys[i].x = this.flys[i]._x + this._frameSize.width * 1.5;
playDragonBoneAnimation(this.flys[i], 'normal', -1); playDragonBoneAnimation(this.flys[i], 'normal', -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment