fix zombies spawn on x or y = 0
This commit is contained in:
parent
0b13018263
commit
7607e80c08
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
@ -1,4 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="JavadocGenerationManager">
|
||||||
|
<option name="OUTPUT_DIRECTORY" value="$PROJECT_DIR$/docs" />
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@ -128,7 +128,15 @@ public class Tiles implements Drawable {
|
|||||||
|
|
||||||
void spawn_zombie() {
|
void spawn_zombie() {
|
||||||
if(num_enemies < 30) {
|
if(num_enemies < 30) {
|
||||||
tileMap[rand.nextInt(80)][rand.nextInt(80)].character = new Enemy(window, 20);
|
int x = rand.nextInt(80);
|
||||||
|
int y = rand.nextInt(80);
|
||||||
|
if (x == 0) {
|
||||||
|
x = 1;
|
||||||
|
}
|
||||||
|
if (y == 0) {
|
||||||
|
y = 1;
|
||||||
|
}
|
||||||
|
tileMap[y][x].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);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user