|
@@ -191,9 +191,9 @@ const initGame = () => {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
if (currentScene.value == 'gameover') {
|
|
if (currentScene.value == 'gameover') {
|
|
// restartGame();
|
|
// restartGame();
|
|
- emit('confirmExit', { type: 1 });
|
|
|
|
|
|
+ emit('confirmExit', { type: 2, area: props.currentGameArea });
|
|
}
|
|
}
|
|
- }, 3000)
|
|
|
|
|
|
+ }, 5000)
|
|
});
|
|
});
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
if (currentScene.value === 'start') {
|
|
if (currentScene.value === 'start') {
|
|
@@ -373,9 +373,10 @@ class GameScene extends Phaser.Scene {
|
|
//this.player = this.physics.add.sprite(clientObj.value.width / 2, clientObj.value.height - 100, 'playerAnim');
|
|
//this.player = this.physics.add.sprite(clientObj.value.width / 2, clientObj.value.height - 100, 'playerAnim');
|
|
this.player = this.physics.add.sprite(direction.value + 46, clientObj.value.height - 100, 'playerAnim');
|
|
this.player = this.physics.add.sprite(direction.value + 46, clientObj.value.height - 100, 'playerAnim');
|
|
this.player.setCollideWorldBounds(true);
|
|
this.player.setCollideWorldBounds(true);
|
|
- this.player.setScale(0.8);
|
|
|
|
|
|
+ this.player.setScale(2.5);
|
|
this.player.lives = this.lives;
|
|
this.player.lives = this.lives;
|
|
this.player.setDepth(9);
|
|
this.player.setDepth(9);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
createHUD() {
|
|
createHUD() {
|
|
@@ -473,7 +474,7 @@ class GameScene extends Phaser.Scene {
|
|
|
|
|
|
// 重新创建事件(使用安全的场景上下文)
|
|
// 重新创建事件(使用安全的场景上下文)
|
|
this.obstacleEvent = this.time.addEvent({
|
|
this.obstacleEvent = this.time.addEvent({
|
|
- delay: 1000 / this.level,
|
|
|
|
|
|
+ delay: 1800 / this.level,
|
|
callback: () => { if (this.gameActive) this.spawnObstacle(); },
|
|
callback: () => { if (this.gameActive) this.spawnObstacle(); },
|
|
loop: true
|
|
loop: true
|
|
});
|
|
});
|
|
@@ -495,9 +496,9 @@ class GameScene extends Phaser.Scene {
|
|
spawnObstacle() {
|
|
spawnObstacle() {
|
|
const x = Phaser.Math.Between(30, clientObj.value.width - 30);
|
|
const x = Phaser.Math.Between(30, clientObj.value.width - 30);
|
|
const obstacle = this.physics.add.sprite(x, -50, 'pile');
|
|
const obstacle = this.physics.add.sprite(x, -50, 'pile');
|
|
- obstacle.setScale(0.7);
|
|
|
|
|
|
+ obstacle.setScale(2.5);
|
|
// 降低速度(从原来的this.speed * this.acceleration * 10调整为)
|
|
// 降低速度(从原来的this.speed * this.acceleration * 10调整为)
|
|
- obstacle.setVelocityY(this.speed * this.acceleration * 5); // 速度减半
|
|
|
|
|
|
+ obstacle.setVelocityY(this.speed * this.acceleration * 12); // 速度减半
|
|
obstacle.setDepth(8);
|
|
obstacle.setDepth(8);
|
|
obstacle.type = 'pile';
|
|
obstacle.type = 'pile';
|
|
|
|
|
|
@@ -539,9 +540,9 @@ class GameScene extends Phaser.Scene {
|
|
// powerUp.type = 'broom';
|
|
// powerUp.type = 'broom';
|
|
// }
|
|
// }
|
|
|
|
|
|
- powerUp.setScale(0.7);
|
|
|
|
|
|
+ powerUp.setScale(2.5);
|
|
// 降低道具速度(从原来的this.speed * this.acceleration * 8调整为)
|
|
// 降低道具速度(从原来的this.speed * this.acceleration * 8调整为)
|
|
- powerUp.setVelocityY(this.speed * this.acceleration * 4); // 速度降低
|
|
|
|
|
|
+ powerUp.setVelocityY(this.speed * this.acceleration * 12); // 速度降低
|
|
powerUp.setDepth(8);
|
|
powerUp.setDepth(8);
|
|
|
|
|
|
// 碰撞检测
|
|
// 碰撞检测
|
|
@@ -702,13 +703,13 @@ class GameScene extends Phaser.Scene {
|
|
|
|
|
|
// 创建球门
|
|
// 创建球门
|
|
this.goal = this.physics.add.sprite(clientObj.value.width / 2, 100, 'goal');
|
|
this.goal = this.physics.add.sprite(clientObj.value.width / 2, 100, 'goal');
|
|
- this.goal.setScale(0.8);
|
|
|
|
|
|
+ this.goal.setScale(2.5);
|
|
this.goal.setImmovable(true);
|
|
this.goal.setImmovable(true);
|
|
this.goal.setDepth(5);
|
|
this.goal.setDepth(5);
|
|
|
|
|
|
// 创建守门员
|
|
// 创建守门员
|
|
this.goalkeeper = this.physics.add.sprite(clientObj.value.width / 2, 150, 'goalkeeperAnim');
|
|
this.goalkeeper = this.physics.add.sprite(clientObj.value.width / 2, 150, 'goalkeeperAnim');
|
|
- this.goalkeeper.setScale(0.9);
|
|
|
|
|
|
+ this.goalkeeper.setScale(2);
|
|
this.goalkeeper.setImmovable(true);
|
|
this.goalkeeper.setImmovable(true);
|
|
this.goalkeeper.anims.play('goalkeeperAnim', true);
|
|
this.goalkeeper.anims.play('goalkeeperAnim', true);
|
|
this.goalkeeper.setDepth(7);
|
|
this.goalkeeper.setDepth(7);
|
|
@@ -1022,7 +1023,7 @@ class GameScene extends Phaser.Scene {
|
|
this.physics.pause();
|
|
this.physics.pause();
|
|
|
|
|
|
// 显示游戏结束画面
|
|
// 显示游戏结束画面
|
|
- this.add.image(clientObj.value.width / 2, clientObj.value.height / 2, 'gameOver').setOrigin(0.5);
|
|
|
|
|
|
+ this.add.image(clientObj.value.width / 2, clientObj.value.height / 2, 'gameOver').setOrigin(0.5).setDepth(100);
|
|
|
|
|
|
// 触发游戏结束事件
|
|
// 触发游戏结束事件
|
|
this.time.addEvent({
|
|
this.time.addEvent({
|