Commit bc14a8c0 authored by 范雪寒's avatar 范雪寒

feat: 解决重叠问题;选项正确后读音

parent 18850446
......@@ -324,6 +324,7 @@ cc.Class({
}
},
createBall(answer) {
let ball = null;
if (answer.answerType == 'img') {
......@@ -331,11 +332,24 @@ cc.Class({
} else {
ball = this.createTextBall(answer);
}
const bg = cc.find('Canvas/bg');
ball.x = bg.width / 4 * (RandomInt(0, 3) - 1) + RandomInt(-50, 50);
let ballPosXBaseList = [-bg.width / 4, 0, bg.width / 4];
if (this.lastBallPosXBase !== undefined) {
ballPosXBaseList = ballPosXBaseList.filter(posX => posX != this.lastBallPosXBase);
}
const ballPosXBase = ballPosXBaseList[RandomInt(ballPosXBaseList.length)];
ball.x = ballPosXBase + RandomInt(-50, 50);
ball.y = -bg.height;
ball.parent = bg;
this.lastBallPosXBase = ballPosXBase;
if (answer.rightAnswer) {
ball.audio = answer.answerAudio;
}
cc.tween(ball.getChildByName('bg'))
.to(0.2, { scaleX: 0.98, scaleY: 1.05 })
.to(0.2, { scaleX: 1.02, scaleY: 0.94 })
......@@ -383,7 +397,7 @@ cc.Class({
const time2 = time - time1;
cc.tween(ball)
.to(time1, { y: bg.height / 2 - ball.height / 2 - 50 }, { easing: 'quadOut' })
.delay(0.75)
.delay(0.5)
.to(time2, { y: bg.height }, { easing: 'quadIn' })
.removeSelf()
.start();
......@@ -505,7 +519,7 @@ cc.Class({
},
async targetDistroy(node) {
this.playAudio('right');
node.stopAllActions();
const bg = node.getChildByName('bg');
bg.active = false;
const DistroyAnime = node.getChildByName('DistroyAnime');
......@@ -514,6 +528,10 @@ cc.Class({
cc.tween(Mask)
.to(0.5, { opacity: 0 })
.start();
await this.playAudioSync('right');
await playAudioByUrlSync(node.audio);
node.removeFromParent();
},
async targetLaugh(node) {
......
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