林旭祥 hai 1 mes
pai
achega
f9c23219b2
Modificáronse 1 ficheiros con 25 adicións e 24 borrados
  1. 25 24
      src/views/game/fruit.vue

+ 25 - 24
src/views/game/fruit.vue

@@ -410,19 +410,20 @@ const mathTool = {
 
   randomVelocityX(posX) {
     if (posX < 0) {
-      return this.randomMinMax(100, 500);
+      return this.randomMinMax(100, 400);
     } else if (posX >= 0 && posX < width / 2) {
-      return this.randomMinMax(0, 500);
+      return this.randomMinMax(0, 400);
     } else if (posX >= width / 2 && posX < width) {
-      return this.randomMinMax(-500, 0);
+      return this.randomMinMax(-400, 0);
     } else {
-      return this.randomMinMax(-500, -100);
+      return this.randomMinMax(-400, -100);
     }
   },
 
   randomVelocityY() {
-    const myH = height - 480;
-    return this.randomMinMax(-900 - myH, -850 - myH);
+    const myH = height - 600;
+    // 调整范围为原速度的70%左右(根据需要微调)
+    return this.randomMinMax(-630 - myH * 0.5, -595 - myH * 0.5);
   },
 
   degCos(deg) {
@@ -1179,7 +1180,7 @@ class PlayScene extends Phaser.Scene {
     this.x = null;
     this.xx = null;
     this.xxx = null;
-    this.gravity = 600;
+    this.gravity = 200;
   }
 
   create() {
@@ -1354,24 +1355,24 @@ class PlayScene extends Phaser.Scene {
 
   startFruit() {
 
-  // 根据分数动态调整数量:分数越高,生成越多水果
-  let min = 1;
-  let max = 1;
-  
-  if (this.score >=0 && this.score <30) {
-    min = 1;
-    max = 1;
-  } else if (this.score >=30 && this.score <60) {
-    min = 1;
-    max = 2;
-  }else{
-    min = 2;
-    max = 3;
-  }
+    // 根据分数动态调整数量:分数越高,生成越多水果
+    let min = 1;
+    let max = 1;
+
+    if (this.score >= 0 && this.score < 30) {
+      min = 1;
+      max = 1;
+    } else if (this.score >= 30 && this.score < 60) {
+      min = 1;
+      max = 2;
+    } else {
+      min = 2;
+      max = 3;
+    }
 
-  const number = Math.floor(mathTool.randomMinMax(min, max + 1)); // +1是因为randomMinMax的max是 exclusive
-  const hasBomb = Math.random() > 0.9;
-  const bombIndex = hasBomb ? Math.floor(Math.random() * number) : -1;
+    const number = Math.floor(mathTool.randomMinMax(min, max + 1)); // +1是因为randomMinMax的max是 exclusive
+    const hasBomb = Math.random() > 0.9;
+    const bombIndex = hasBomb ? Math.floor(Math.random() * number) : -1;
 
     for (let i = 0; i < number; i++) {
       if (i === bombIndex) {