Fix death bug
This commit is contained in:
parent
7d327d22a4
commit
04b35548bd
@ -1,8 +1,11 @@
|
|||||||
|
import processing.core.PVector;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -57,6 +60,9 @@ public final class FileHandleUtil {
|
|||||||
*/
|
*/
|
||||||
public void addScore(Score score) throws IOException {
|
public void addScore(Score score) throws IOException {
|
||||||
List<Score> scores = this.readScores();
|
List<Score> scores = this.readScores();
|
||||||
|
if (scores.isEmpty()) {
|
||||||
|
scores.add(new Score(1, LocalDateTime.now(), 20, new PVector(0, 0), 20));
|
||||||
|
}
|
||||||
scores.set(0, score);
|
scores.set(0, score);
|
||||||
|
|
||||||
scores.sort(Comparator.comparing(Score::getScore).thenComparing(Comparator.comparing(Score::getDate)));
|
scores.sort(Comparator.comparing(Score::getScore).thenComparing(Comparator.comparing(Score::getDate)));
|
||||||
|
|||||||
@ -109,7 +109,7 @@ public class Tiles implements Drawable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void spawn_zombie() {
|
void spawn_zombie() {
|
||||||
if(num_enemies < 3) {
|
if(num_enemies < 30) {
|
||||||
tileMap[rand.nextInt(100)][rand.nextInt(100)].character = new Enemy(window, 20);
|
tileMap[rand.nextInt(100)][rand.nextInt(100)].character = new Enemy(window, 20);
|
||||||
num_enemies++;
|
num_enemies++;
|
||||||
System.out.println("Number of Zombies: " + num_enemies);
|
System.out.println("Number of Zombies: " + num_enemies);
|
||||||
|
|||||||
@ -37,7 +37,5 @@ public class UI {
|
|||||||
|
|
||||||
public void draw() {
|
public void draw() {
|
||||||
bottomBar(400, 700);
|
bottomBar(400, 700);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user