|
@@ -1354,9 +1354,24 @@ class PlayScene extends Phaser.Scene {
|
|
|
|
|
|
startFruit() {
|
|
|
|
|
|
- const number = Math.floor(mathTool.randomMinMax(1, 3));
|
|
|
- const hasBomb = Math.random() > 0.9; // 炸弹概率
|
|
|
- const bombIndex = hasBomb ? Math.floor(Math.random() * number) : -1;
|
|
|
+ // 根据分数动态调整数量:分数越高,生成越多水果
|
|
|
+ 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;
|
|
|
|
|
|
for (let i = 0; i < number; i++) {
|
|
|
if (i === bombIndex) {
|