Skip to content

Commit f109138

Browse files
committed
Fixed spam-spawn bug. The last commit is mine!
1 parent 8853efe commit f109138

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/seprini/controllers/AircraftController.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ public void update(float delta) throws InterruptedException {
134134
Art.getSound("warning").play(1.0f);
135135
}
136136

137-
// If the number of aircraft is below the maximum permitted, or the time
138-
// elapsed since the last generation is less than
137+
// If the number of aircraft is below the maximum permitted and the time
138+
// elapsed since the last generation is greater than the preset
139139
// time difference between aircraft generated, create a new aircraft
140-
if (aircraftList.size() > difficulty.getMaxAircraft()
141-
|| timer - lastGenerated > difficulty
140+
if (aircraftList.size() < difficulty.getMaxAircraft()
141+
&& timer - lastGenerated > difficulty
142142
.getTimeBetweenGenerations() + rand.nextInt(100)) {
143143
final Aircraft generatedAircraft = generateAircraft();
144144

0 commit comments

Comments
 (0)