Commit 936126a2 authored by Tt's avatar Tt

制作完成

parent e57929b2
This diff is collapsed.
......@@ -151,7 +151,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let item = cc.instantiate(paoaoParent)
let pos = posArr[i];
layer_paopao.addChild(item)
this.updatePaoPao(item, data, pos);
this.updatePaoPao(item, data, pos, i);
}
pg.hw.playLocalAudio('fly')
this.scheduleOnce(() => {
......@@ -166,8 +166,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
return this.currentQuestion.options.filter(op => op.right);
}
updatePaoPao(item, data, pos) {
updatePaoPao(item, data, pos, i) {
let bubble = item.getChildByName("bubble")
let bg_img_0 = bubble.getChildByName('bg_img_0')
let bg_img_1 = bubble.getChildByName('bg_img_1')
let bg_img_2 = bubble.getChildByName('bg_img_2')
bg_img_0.active = i == 0;
bg_img_1.active = i == 1;
bg_img_2.active = i == 2;
let broken = item.getChildByName("bubble_broken")
let img = bubble.getChildByName("img")
let text = bubble.getChildByName("text")
......@@ -189,41 +195,53 @@ export default class SceneComponent extends MyCocosSceneComponent {
item.x = pos.x;
item.y = pos.y - 1000
cc.tween(item).to(2, { y: pos.y }).call(() => { }).start();
let time = i == 1 ? 1.3 : i == 2 ? 1.6 : 2;//
cc.tween(item)
.to(time, { y: pos.y })
.to(0.3, { scaleY: 1.1, y: pos.y + 50 })
.to(0.3, { scaleY: 1, y: pos.y })
.call(() => {
}).start();
}
// 点击泡泡
touchPaoPao(e: any) {
if (!this.canTouch) return;
// 如果泡泡没有到指定位置不允许点击
let item = e.target;
let data = e.target.data;
// 成功 泡泡破碎 里面的内容消失
let bubble = e.target.getChildByName("bubble")
let broken = e.target.getChildByName("bubble_broken")
let right = e.target.getChildByName("bubble_right")
if (data.right) {
this.rightList.push(data);
cc.Tween.stopAllByTarget(item)
pg.view.visible(bubble, false)
pg.view.visible(broken, true)
pg.view.visible(right, true)
pg.hw.playLocalAudio('right')
pg.view.playDBAnimation(right, "newAnimation", 1)
cc.tween(item).delay(0.5).call(() => {
pg.hw.playLocalAudio('right')
}).by(0.5, { y: 1500 }).start();
this.rightList.push(data);
// 处理剩余的节点
if (this.rightList.length == this.currentRightList.length) {
let layer_paopao = pg.view.find(this, 'layer_game/layer_paopao')
let children = layer_paopao.children;
children.forEach(node => {
if (this.rightList.some(dt => node.data.id == dt.id)) return;
cc.tween(node).by(0.5, { y: -1500 }).start();
})
}
this.scheduleOnce(() => {
item.parent = null;
// 处理剩余的节点
if (this.rightList.length == this.currentRightList.length) {
cc.Tween.stopAll();
this.startCreate = false;
this.nextQuestion();
let layer_paopao = pg.view.find(this, 'layer_game/layer_paopao')
let children = layer_paopao.children;
children.forEach((node, i) => {
if (this.rightList.some(dt => node.data.id == dt.id)) return;
cc.tween(node).by(0.5 + (i / children.length) * 0.5, { y: -1500 }).start();
})
}
}, 1);
this.scheduleOnce(() => {
item.parent = null;
if (this.rightList.length == this.currentRightList.length) {
cc.Tween.stopAll();
this.startCreate = false;
this.nextQuestion();
}
}, 1);
}).by(0.5, { y: 1500 }).start();
} else {
pg.view.visible(bubble, false)
pg.view.visible(broken, true)
......
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