|
|
@@ -30,6 +30,42 @@ export default class CheckpointRedBagItem extends cc.Component {
|
|
|
start() {
|
|
|
this.node_icon.active = false;
|
|
|
this.hb520.active = true;
|
|
|
+ this.zFalling();
|
|
|
+ }
|
|
|
+ /** z字落地术 */
|
|
|
+ private zFalling() {
|
|
|
+ // z字三点式
|
|
|
+ let end_pos1 = this.node.getPosition();
|
|
|
+ let end_pos2 = this.node.getPosition();
|
|
|
+ let end_pos3 = this.node.getPosition();
|
|
|
+ // 左右坐标
|
|
|
+ if (this.node.x >= 0) {
|
|
|
+ // 在右边,左飘
|
|
|
+ end_pos1.x -= this.node.width * 3;
|
|
|
+ end_pos2.x -= this.node.width * 1;
|
|
|
+ end_pos3.x -= this.node.width * 2;
|
|
|
+ } else {
|
|
|
+ // 在左边,右飘
|
|
|
+ end_pos1.x += this.node.width * 3;
|
|
|
+ end_pos2.x += this.node.width * 1;
|
|
|
+ end_pos3.x += this.node.width * 2;
|
|
|
+ }
|
|
|
+ // 上下坐标
|
|
|
+ if (this.node.y <= -200) {
|
|
|
+ // 在下面
|
|
|
+ end_pos1.y += this.node.height / 1;
|
|
|
+ end_pos2.y += this.node.height * 1.5;
|
|
|
+ end_pos3.y += this.node.height * 2;
|
|
|
+ } else {
|
|
|
+ // 在上面
|
|
|
+ end_pos1.y -= this.node.height / 2;
|
|
|
+ end_pos2.y -= this.node.height;
|
|
|
+ end_pos3.y -= this.node.height * 1.2;
|
|
|
+ }
|
|
|
+ let pos1 = cc.tween().to(0.5, { position: end_pos1 })
|
|
|
+ let pos2 = cc.tween().to(0.5, { position: end_pos2 })
|
|
|
+ let pos3 = cc.tween().to(0.5, { position: end_pos3 })
|
|
|
+ cc.tween(this.node).then(pos1).then(pos2).then(pos3).start();
|
|
|
}
|
|
|
private flyNode() {
|
|
|
if (this.anim_playing) return;
|