|
@@ -18,17 +18,24 @@ export default class Step1 extends BaseEvent {
|
|
|
onLoad() {
|
|
|
super.onLoad()
|
|
|
EventListener.on("Step1", this.npcJump, this);
|
|
|
- this.npc_1.active = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ start() {
|
|
|
+ if (this.npc_1) {
|
|
|
+ this.npc_1.active = false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
npcJump() {
|
|
|
- this.npc_1.active = true;
|
|
|
- cc.tween(this.npc_1).sequence(
|
|
|
- cc.moveTo(0.5, cc.v2(this.npc_1.x + 300, this.npc_1.y)),
|
|
|
- cc.callFunc(() => {
|
|
|
- console.log("======小矮人跳出来======")
|
|
|
- })
|
|
|
- ).start();
|
|
|
+ if (this.npc_1) {
|
|
|
+ this.npc_1.active = true;
|
|
|
+ cc.tween(this.npc_1).sequence(
|
|
|
+ cc.moveTo(0.5, cc.v2(this.npc_1.x + 300, this.npc_1.y)),
|
|
|
+ cc.callFunc(() => {
|
|
|
+ console.log("======小矮人跳出来======")
|
|
|
+ })
|
|
|
+ ).start();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|