|
@@ -965,6 +965,8 @@ class MainScene extends Phaser.Scene {
|
|
|
|
|
|
// 更新刀光
|
|
// 更新刀光
|
|
this.blade.update();
|
|
this.blade.update();
|
|
|
|
+ this.leftBlade.update();
|
|
|
|
+ this.rightBlade.update();
|
|
|
|
|
|
// 检查水果碰撞
|
|
// 检查水果碰撞
|
|
if (this.sandia && this.sandia.getSprite() && this.sandia.getSprite().active && !this.start) {
|
|
if (this.sandia && this.sandia.getSprite() && this.sandia.getSprite().active && !this.start) {
|
|
@@ -976,25 +978,23 @@ class MainScene extends Phaser.Scene {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- // 分别更新左右手刀光
|
|
|
|
- this.leftBlade.update();
|
|
|
|
- this.rightBlade.update();
|
|
|
|
-
|
|
|
|
// 分别检测左右手刀光与水果的碰撞
|
|
// 分别检测左右手刀光与水果的碰撞
|
|
if (this.sandia && this.sandia.getSprite() && !this.start) {
|
|
if (this.sandia && this.sandia.getSprite() && !this.start) {
|
|
// 右手碰撞检测
|
|
// 右手碰撞检测
|
|
this.rightBlade.checkCollide(
|
|
this.rightBlade.checkCollide(
|
|
this.sandia.getSprite(),
|
|
this.sandia.getSprite(),
|
|
- () => this.startGame()
|
|
|
|
|
|
+ () => {
|
|
|
|
+ this.startGame()
|
|
|
|
+ }
|
|
);
|
|
);
|
|
// 左手碰撞检测(可选:允许左手也能启动游戏)
|
|
// 左手碰撞检测(可选:允许左手也能启动游戏)
|
|
this.leftBlade.checkCollide(
|
|
this.leftBlade.checkCollide(
|
|
this.sandia.getSprite(),
|
|
this.sandia.getSprite(),
|
|
- () => this.startGame()
|
|
|
|
|
|
+ () => {
|
|
|
|
+ this.startGame()
|
|
|
|
+ }
|
|
);
|
|
);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
homeGroupAnim() {
|
|
homeGroupAnim() {
|
|
@@ -1316,6 +1316,7 @@ class PlayScene extends Phaser.Scene {
|
|
bestAnim() {
|
|
bestAnim() {
|
|
this.best = this.add.image(-100, 52, 'best');
|
|
this.best = this.add.image(-100, 52, 'best');
|
|
this.best.setOrigin(0, 0);
|
|
this.best.setOrigin(0, 0);
|
|
|
|
+ this.best.setScale(scaleRatio.value);
|
|
this.tweens.add({
|
|
this.tweens.add({
|
|
targets: this.best,
|
|
targets: this.best,
|
|
x: 5,
|
|
x: 5,
|
|
@@ -1325,11 +1326,12 @@ class PlayScene extends Phaser.Scene {
|
|
}
|
|
}
|
|
|
|
|
|
scoreTextAnim() {
|
|
scoreTextAnim() {
|
|
- this.scoreText = this.add.bitmapText(-100, 40, 'number', this.score.toString(), 32);
|
|
|
|
|
|
+ this.scoreText = this.add.bitmapText(-100, 20, 'number', this.score.toString(), 40);
|
|
this.scoreText.setOrigin(0, 0);
|
|
this.scoreText.setOrigin(0, 0);
|
|
|
|
+ this.scoreText.setScale(scaleRatio.value);
|
|
this.tweens.add({
|
|
this.tweens.add({
|
|
targets: this.scoreText,
|
|
targets: this.scoreText,
|
|
- x: 75,
|
|
|
|
|
|
+ x: 150,
|
|
duration: 300,
|
|
duration: 300,
|
|
ease: 'Sine.InOut'
|
|
ease: 'Sine.InOut'
|
|
});
|
|
});
|
|
@@ -1343,10 +1345,10 @@ class PlayScene extends Phaser.Scene {
|
|
this.xxx = this.add.image(49, 0, 'xxx');
|
|
this.xxx = this.add.image(49, 0, 'xxx');
|
|
|
|
|
|
this.xxxGroup.add([this.x, this.xx, this.xxx]);
|
|
this.xxxGroup.add([this.x, this.xx, this.xxx]);
|
|
-
|
|
|
|
|
|
+ this.xxxGroup.setScale(scaleRatio.value);
|
|
this.tweens.add({
|
|
this.tweens.add({
|
|
targets: this.xxxGroup,
|
|
targets: this.xxxGroup,
|
|
- x: width - 86,
|
|
|
|
|
|
+ x: width - 170,
|
|
duration: 300,
|
|
duration: 300,
|
|
ease: 'Sine.InOut'
|
|
ease: 'Sine.InOut'
|
|
});
|
|
});
|
|
@@ -1577,7 +1579,7 @@ class PlayScene extends Phaser.Scene {
|
|
removeObj.destroy();
|
|
removeObj.destroy();
|
|
const newObj = this.add.sprite(removeObj.x, removeObj.y, addKey);
|
|
const newObj = this.add.sprite(removeObj.x, removeObj.y, addKey);
|
|
newObj.setOrigin(0, 0);
|
|
newObj.setOrigin(0, 0);
|
|
- newObj.setScale(0);
|
|
|
|
|
|
+ newObj.setScale(scaleRatio.value);
|
|
this.xxxGroup.add(newObj);
|
|
this.xxxGroup.add(newObj);
|
|
|
|
|
|
this.tweens.add({
|
|
this.tweens.add({
|
|
@@ -1696,7 +1698,7 @@ onBeforeMount(() => {
|
|
|
|
|
|
// 初始化游戏
|
|
// 初始化游戏
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- clientObj.value = {
|
|
|
|
|
|
+ clientObj.value = {
|
|
width: document.documentElement.clientWidth,
|
|
width: document.documentElement.clientWidth,
|
|
height: document.documentElement.clientHeight,
|
|
height: document.documentElement.clientHeight,
|
|
}
|
|
}
|
|
@@ -1712,7 +1714,7 @@ onMounted(() => {
|
|
mathTool.init();
|
|
mathTool.init();
|
|
|
|
|
|
// 创建游戏实例
|
|
// 创建游戏实例
|
|
- game = new Phaser.Game({
|
|
|
|
|
|
+ const game: any = new Phaser.Game({
|
|
type: Phaser.CANVAS,
|
|
type: Phaser.CANVAS,
|
|
width: width,
|
|
width: width,
|
|
height: height,
|
|
height: height,
|