Commit 4fb4b0a7 authored by haiyoucuv's avatar haiyoucuv

22

parent 144ce692
......@@ -16,6 +16,7 @@ import { Level10 } from "@/pages/GamePage/Level/Level10.ts";
import { Level13 } from "@/pages/GamePage/Level/Level13.ts";
import { Level14 } from "@/pages/GamePage/Level/Level14.ts";
import { Level18 } from "@/pages/GamePage/Level/Level18.ts";
import { Level22 } from "@/pages/GamePage/Level/Level22.ts";
import { Level23 } from "@/pages/GamePage/Level/Level23.ts";
import gameStore from "@/store/gameStore.ts";
import { LevelArr } from "@/pages/GamePage/Level/LevelConfig.ts";
......@@ -30,7 +31,7 @@ export class Game extends Base {
const qsBg = this.addChild(new Sprite(Assets.get("问题.png")));
qsBg.position.set(49, 316);
this.level = this.addChild(new Level6());
this.level = this.addChild(new Level22());
gameStore.start();
......
import { LevelBase } from "@/pages/GamePage/Components/LevelBase.ts";
import { Assets, Sprite } from "pixi.js";
import { Ease, Tween } from "@/core/tween";
import { GameEvent, globalEvent } from "@/pages/GamePage/GameEvent.ts";
export class Level22 extends LevelBase {
level: number = 22;
A: Sprite;
B: Sprite;
right: Sprite;
onLoad() {
super.onLoad();
this.addChild(new Sprite(Assets.get(`level${this.level}/底.png`)))
.position.set(194, 697);
this.B = this.addChild(new Sprite(Assets.get(`level${this.level}/裤子.png`)));
this.B.position.set(267, 1119);
this.A = this.addChild(new Sprite(Assets.get(`level${this.level}/衣服.png`)));
this.A.position.set(195, 808);
const x = this.addChild(new Sprite(Assets.get(`level${this.level}/头.png`)))
x.position.set(282, 697);
x.interactive = false;
x.eventMode = "none";
this.right = this.addChild(new Sprite(Assets.get(`level${this.level}/right.png`)));
this.right.position.set(452, 1242);
this.right.alpha = 0;
this.right.interactive = false;
this.right.eventMode = "none";
[this.A, this.B].forEach((item) => {
item.on("pointerdown", this.onAPointerDown, this);
item.on("pointerup", this.onAPointerUp, this);
item.on("globalpointermove", this.onAPointerMove, this);
});
}
target = null;
pos = null;
onAPointerUp(e) {
this.pos = null;
}
onAPointerDown(e) {
this.target = e.target;
const { x, y } = e.data.global;
this.pos = {
x: x - e.target.x,
y: y - e.target.y
}
}
onAPointerMove(e) {
if (!this.pos) return;
const { x, y } = e.data.global;
const nx = x - this.pos.x;
const ny = y - this.pos.y;
this.target.position.set(nx, ny);
this.check();
}
check() {
const { x: ax, y: ay } = this.A;
const { x: bx, y: by } = this.B;
if (
(ax < 0 || ax > 425 || ay < 600 || ay > 970)
&& (bx < 80 || bx > 450 || by < 840 || by > 1200)
) {
this.setTouchEnable(false);
Tween.get(this.right)
.to({ alpha: 1 }, 666, Ease.quadInOut)
.wait(2000)
.call(() => {
globalEvent.emit(GameEvent.NextLevel);
});
}
}
onDestroy() {
super.onDestroy();
Tween.removeTweens(this.right);
[this.A, this.B].forEach((item) => {
item.off("globalpointermove", this.onAPointerMove, this);
});
}
}
......@@ -11,6 +11,7 @@ import { Level10 } from "@/pages/GamePage/Level/Level10.ts";
import { Level13 } from "@/pages/GamePage/Level/Level13.ts";
import { Level14 } from "@/pages/GamePage/Level/Level14.ts";
import { Level18 } from "@/pages/GamePage/Level/Level18.ts";
import { Level22 } from "@/pages/GamePage/Level/Level22.ts";
import { Level23 } from "@/pages/GamePage/Level/Level23.ts";
......@@ -20,23 +21,23 @@ export const LevelArr = [
{ cls: Level3, tip: `当然是太阳最高啦` },
{ cls: Level4, tip: `没有什么比猫猫的<br/>左右爪更像了` },
{ cls: Level5, tip: `将蛋黄放在蛋白上<br/>拼出荷包蛋` },
{ cls: Level6, tip: `直接移动最底层的蛋糕` }, // 6
{ cls: Level6, tip: `直接移动最底层的蛋糕` },
{ cls: Level7, tip: `旋转存钱罐,倒出金币` },
{ cls: Level8, tip: `最深的颜色是题目` },
{ cls: Level9, tip: `移动小鸭子至河边` },
{ cls: Level10, tip: `将“1”移动至等号右边<br/>形成等式` }, // 10
{ cls: Level10, tip: `将“1”移动至等号右边<br/>形成等式` },
{ cls: Level9, tip: `将冰箱放大至能装够装下<br/>长颈鹿` }, // 11
{ cls: Level9, tip: `掐断烟头` }, // 12
{ cls: Level13, tip: `打开盖子看看` }, // 13
{ cls: Level13, tip: `打开盖子看看` },
{ cls: Level14, tip: `将香蕉移动到牛奶中<br/>变成香蕉牛奶` },
{ cls: Level14, tip: `猫吃老鼠` }, // 15
{ cls: Level14, tip: `移动笼子罩住小鸭子` }, // 16
{ cls: Level14, tip: `别忘了,人是高等动物哦` }, // 17
{ cls: Level18, tip: `移开乌云露出太阳<br/>让冰块融化` }, // 18
{ cls: Level18, tip: `移开乌云露出太阳<br/>让冰块融化` },
{ cls: Level14, tip: `将冰箱放大至能够装下长颈鹿` }, // 19
{ cls: Level14, tip: `别忘了把题目也装进箱子里` }, // 20
{ cls: Level14, tip: `移动鸡蛋,碰一碰便知` }, // 21
{ cls: Level14, tip: `移开圣诞老人的衣服看看` }, // 22
{ cls: Level22, tip: `移开圣诞老人的衣服看看` },
{ cls: Level23, tip: `一样重` },
{ cls: Level23, tip: `将雪球合在一起滚成大雪球` }, // 24
{ cls: Level23, tip: `按住小猪鼻子,把它憋醒` }, // 25
......
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