Commit 18bffb4e authored by linzhiguo's avatar linzhiguo

+ 增加扔病毒动画

# 连打加速通关
parent 12cb4fae
This diff is collapsed.
...@@ -26,6 +26,11 @@ cc.Class({ ...@@ -26,6 +26,11 @@ cc.Class({
type: cc.Node type: cc.Node
}, },
fallVirus:{
default:[],
type: cc.Node
},
titleText:{ titleText:{
default:null, default:null,
type: cc.Label type: cc.Label
...@@ -98,6 +103,7 @@ cc.Class({ ...@@ -98,6 +103,7 @@ cc.Class({
for(let i = 0; i < 2; i ++){ for(let i = 0; i < 2; i ++){
this.setTextVar(this.flyVirus[i]); this.setTextVar(this.flyVirus[i]);
this.setTextVar(this.virusOks[i]); this.setTextVar(this.virusOks[i]);
this.setTextVar(this.fallVirus[i]);
} }
this._area = cc.find('Canvas/bg/flag_area'); this._area = cc.find('Canvas/bg/flag_area');
...@@ -260,6 +266,9 @@ cc.Class({ ...@@ -260,6 +266,9 @@ cc.Class({
this.node.on(cc.Node.EventType.TOUCH_START, (event)=>{ this.node.on(cc.Node.EventType.TOUCH_START, (event)=>{
if (this._touched == true) if (this._touched == true)
return; return;
if (this._can_hitted == false)
return;
let canvas = cc.find('Canvas'); let canvas = cc.find('Canvas');
let pos = canvas.convertToNodeSpaceAR(cc.v2(event.touch._point.x, event.touch._point.y)) let pos = canvas.convertToNodeSpaceAR(cc.v2(event.touch._point.x, event.touch._point.y))
...@@ -275,19 +284,23 @@ cc.Class({ ...@@ -275,19 +284,23 @@ cc.Class({
this._flyswatter.y = pos.y; this._flyswatter.y = pos.y;
this._touched = false; this._touched = false;
playDragonBoneAnimation(this._flyswatter.children[0], 'normal'); playDragonBoneAnimation(this._flyswatter.children[0], 'normal');
cc.tween(this._flyswatter) item._dizzy_ani = cc.tween(this._flyswatter)
.delay(0.2) .delay(0.2)
.call(()=>{ .call(()=>{
if (i != this._correct_index){ if (i != this._correct_index){
playDragonBoneAnimation(item, 'dizzy', 1, ()=>{ playDragonBoneAnimation(item, 'dizzy', 1, ()=>{
this.setTimer();
playDragonBoneAnimation(item, 'normal', -1); playDragonBoneAnimation(item, 'normal', -1);
}); });
// cc.tween(this._time_node) if (item._recount_timer){
// .delay(1) item._recount_timer.stop();
// .call(()=>{ item._recount_timer = null;
// }) }
// .start(); item._recount_timer = cc.tween(this._time_node)
.delay(1)
.call(()=>{
this.setTimer();
})
.start();
} }
else{ else{
this.fallCare(); this.fallCare();
...@@ -363,6 +376,9 @@ cc.Class({ ...@@ -363,6 +376,9 @@ cc.Class({
}, },
setTimer(){ setTimer(){
console.log('time');
this._can_hitted = true;
this._current_time = this._time_node.x; this._current_time = this._time_node.x;
this._timer_ani = cc.tween(this._time_node) this._timer_ani = cc.tween(this._time_node)
.to(this._current_time, {x: 0}) .to(this._current_time, {x: 0})
...@@ -379,6 +395,8 @@ cc.Class({ ...@@ -379,6 +395,8 @@ cc.Class({
}, },
cleanTimer(){ cleanTimer(){
console.log('clean');
if (this._timer_ani){ if (this._timer_ani){
this._timer_ani.stop(); this._timer_ani.stop();
this._timer_ani = null; this._timer_ani = null;
...@@ -432,6 +450,8 @@ cc.Class({ ...@@ -432,6 +450,8 @@ cc.Class({
this.flyVirus[i]._text.fontSize = 64; this.flyVirus[i]._text.fontSize = 64;
this.virusOks[i]._text.string = idxs[i]; this.virusOks[i]._text.string = idxs[i];
this.virusOks[i]._text.fontSize = 64; this.virusOks[i]._text.fontSize = 64;
this.fallVirus[i]._text.string = idxs[i];
this.fallVirus[i]._text.fontSize = 64;
} }
}, },
...@@ -481,6 +501,8 @@ cc.Class({ ...@@ -481,6 +501,8 @@ cc.Class({
} }
this._index ++; this._index ++;
console.log(this._index,'try');
if (this._index >= this.data.length){ if (this._index >= this.data.length){
this._finished = true; this._finished = true;
...@@ -513,6 +535,9 @@ cc.Class({ ...@@ -513,6 +535,9 @@ cc.Class({
this.virusOks[i].active = true; 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.unitedFontSize(this.fallVirus, 240, 64);
this.fallVirus[i].active = false;
} }
cc.tween(this.flys[0]) cc.tween(this.flys[0])
...@@ -530,9 +555,33 @@ cc.Class({ ...@@ -530,9 +555,33 @@ cc.Class({
flyOut(){ flyOut(){
this._sound_button._sprite.active = false; this._sound_button._sprite.active = false;
this._can_hitted = false;
for(let i = 0; i < 2; i++){ for(let i = 0; i < 2; i++){
this.flyVirus[i].active = false; this.flyVirus[i].active = false;
this.fallVirus[i].active = true;
let pos = this.flyVirus[i].convertToWorldSpaceAR(cc.v2(0,0));
pos.y = pos.y - 23;
let pos1 = this.fallVirus[i].parent.convertToNodeSpaceAR(cc.v2(pos.x, pos.y));
this.fallVirus[i].x = pos1.x;
this.fallVirus[i].y = pos1.y;
this.fallVirus[i].opacity = 255;
pos = this.virusOks[i].convertToWorldSpaceAR(cc.v2(0,0));
pos1 = this.fallVirus[i].parent.convertToNodeSpaceAR(cc.v2(pos.x, pos.y));
cc.tween(this.fallVirus[i])
.to(0.2, {x: pos1.x, y: pos1.y, scaleX: 0.811, scaleY: 0.8})
.to(0.1, {opacity:53.55})
.call(()=>{
this.virusOks[i].active = true;
this.fallVirus[i].active = false;
})
.start();
//y-23
//move oks scale opacity
playDragonBoneAnimation(this.flys[i], 'laugh', 1, ()=>{ playDragonBoneAnimation(this.flys[i], 'laugh', 1, ()=>{
playDragonBoneAnimation(this.flys[i], 'normal', -1); playDragonBoneAnimation(this.flys[i], 'normal', -1);
cc.tween(this.flys[i]) cc.tween(this.flys[i])
...@@ -541,12 +590,12 @@ cc.Class({ ...@@ -541,12 +590,12 @@ cc.Class({
}); });
} }
cc.tween(this.node) this._bad_water.active = true;
this._bad_water.opacity = 0;
cc.tween(this._bad_water)
.delay(0.2) .delay(0.2)
.to(0.1, {opacity: 255})
.call(()=>{ .call(()=>{
this.virusOks[0].active = true;
this.virusOks[1].active = true;
this._bad_water.active = true;
}) })
.delay(0.5) .delay(0.5)
.call(()=>{ .call(()=>{
...@@ -557,6 +606,7 @@ cc.Class({ ...@@ -557,6 +606,7 @@ cc.Class({
}, },
fallCare(){ fallCare(){
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++){
......
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