|
@@ -9,12 +9,30 @@ const { ccclass, property } = cc._decorator;
|
|
|
@ccclass
|
|
|
export default class JG0108_1 extends BaseEvent {
|
|
|
|
|
|
+ @property({
|
|
|
+ displayName: '数值(怪物id)'
|
|
|
+ })
|
|
|
+ public monsterId = 1001;
|
|
|
+
|
|
|
/**
|
|
|
* 主角进入碰撞区域
|
|
|
* @param tag 碰撞组件编号
|
|
|
*/
|
|
|
public onBegin(tag: number) {
|
|
|
+ let moveV2 = this.ff.mainSprite.moveV2
|
|
|
+ this.ff.mainSprite.setPause(true)
|
|
|
|
|
|
+ let des = 30;
|
|
|
+ let x = -des*moveV2.x
|
|
|
+ let y = -des*moveV2.y
|
|
|
+ this.rmHP()
|
|
|
+ cc.tween(this.ff.mainSprite.node).sequence(
|
|
|
+ cc.moveBy(0.5,cc.v2(x,y)).easing(cc.easeBackOut()),
|
|
|
+ cc.delayTime(0.5),
|
|
|
+ cc.callFunc(()=>{
|
|
|
+ this.ff.mainSprite.setPause(false)
|
|
|
+ })
|
|
|
+ ).start()
|
|
|
}
|
|
|
/**
|
|
|
* 主角离开碰撞区域
|
|
@@ -23,4 +41,9 @@ export default class JG0108_1 extends BaseEvent {
|
|
|
public onEnd(tag: number) {
|
|
|
|
|
|
}
|
|
|
+ private rmHP() {
|
|
|
+ let main = this.ff.main;
|
|
|
+ let attrData = main.sManage.getMonsterData(this.monsterId);
|
|
|
+ this.ff.mainSprite.bAtkjs(attrData);
|
|
|
+ }
|
|
|
}
|