From acc0b66196f4f360c27daa2420e9d18e25e48c99 Mon Sep 17 00:00:00 2001 From: Drew Moore Date: Sun, 1 Jun 2025 20:11:09 -0400 Subject: [PATCH 01/21] FloatingMine now uses Elliptical hitbox. --- src/main/java/com/drewm/entities/Player.java | 2 +- src/main/java/com/drewm/objects/FloatingMine.java | 9 +++++---- src/main/java/com/drewm/objects/SawBlade.java | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/drewm/entities/Player.java b/src/main/java/com/drewm/entities/Player.java index 2c30f6e..e906b03 100644 --- a/src/main/java/com/drewm/entities/Player.java +++ b/src/main/java/com/drewm/entities/Player.java @@ -54,7 +54,7 @@ public Player(float worldX, float worldY, Playing playing, List bullets) this.hitboxHeight = Constants.PLAYER_SPRITE_HEIGHT * Constants.SCALE - 10; this.hitboxOffsetX = 5; this.hitboxOffsetY = 5; - this.showHitbox = false; + this.showHitbox = true; this.pistol = new Pistol(this, bullets); this.currentTimeLeft = maxTimeLimitSeconds; diff --git a/src/main/java/com/drewm/objects/FloatingMine.java b/src/main/java/com/drewm/objects/FloatingMine.java index 6e2bc4c..af1fa05 100644 --- a/src/main/java/com/drewm/objects/FloatingMine.java +++ b/src/main/java/com/drewm/objects/FloatingMine.java @@ -5,6 +5,7 @@ import javax.imageio.ImageIO; import java.awt.*; +import java.awt.geom.Ellipse2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.IOException; @@ -20,7 +21,7 @@ public class FloatingMine { private int spriteCounter = 0; private int spriteNum = 0; private float speed = 1f; - private final boolean showHitbox = false; + private final boolean showHitbox = true; public FloatingMine(float startX, float startY, float endX, float endY, Playing playing) { this.playing = playing; @@ -90,14 +91,14 @@ public void draw(Graphics2D g2) { screenY + Constants.TILE_SIZE * 2 > 0 && screenY < Constants.SCREEN_HEIGHT) { g2.drawImage(spriteFrames[spriteNum], (int) screenX, (int) screenY, spriteFrames[0].getWidth() * Constants.SCALE, spriteFrames[0].getHeight() * Constants.SCALE, null); - if (showHitbox) g2.drawRect((int) screenX, (int) screenY, spriteFrames[0].getWidth() * Constants.SCALE, spriteFrames[0].getHeight() * Constants.SCALE); + if (showHitbox) g2.draw(getScreenBounds()); } } - public Rectangle2D.Float getScreenBounds() { + public Ellipse2D.Float getScreenBounds() { float screenX = this.worldX - playing.player.worldX + playing.player.screenX; float screenY = this.worldY - playing.player.worldY + playing.player.screenY; - return new Rectangle2D.Float(screenX, screenY, spriteFrames[0].getWidth() * Constants.SCALE, spriteFrames[0].getHeight() * Constants.SCALE); + return new Ellipse2D.Float(screenX + 3 * Constants.SCALE, screenY, (spriteFrames[0].getWidth() - 6) * Constants.SCALE, spriteFrames[0].getWidth() * Constants.SCALE); } private float distanceTo(float targetX, float targetY) { diff --git a/src/main/java/com/drewm/objects/SawBlade.java b/src/main/java/com/drewm/objects/SawBlade.java index b727329..9423e3c 100644 --- a/src/main/java/com/drewm/objects/SawBlade.java +++ b/src/main/java/com/drewm/objects/SawBlade.java @@ -21,6 +21,7 @@ public class SawBlade { private int spriteCounter = 0; private int spriteNum = 0; private float speed = 1f; + private boolean showHitbox = true; public SawBlade(float startX, float endX, float y, boolean upsideDown, Playing playing) { this.playing = playing; @@ -93,6 +94,7 @@ public void draw(Graphics2D g2) { screenY + Constants.TILE_SIZE > 0 && screenY < Constants.SCREEN_HEIGHT) { g2.drawImage(spriteFrames[spriteNum], (int) screenX, (int) screenY, spriteFrames[0].getWidth() * Constants.SCALE, spriteFrames[0].getHeight() * Constants.SCALE, null); + if (showHitbox) g2.draw(getScreenBounds()); } } From 3229cfbb4780b1c7523f0f668ee45b59cd110bdf Mon Sep 17 00:00:00 2001 From: Drew Moore Date: Sun, 1 Jun 2025 20:57:00 -0400 Subject: [PATCH 02/21] SawBlade now uses semi-circle hitbox. --- src/main/java/com/drewm/objects/SawBlade.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/drewm/objects/SawBlade.java b/src/main/java/com/drewm/objects/SawBlade.java index 9423e3c..948de52 100644 --- a/src/main/java/com/drewm/objects/SawBlade.java +++ b/src/main/java/com/drewm/objects/SawBlade.java @@ -6,6 +6,8 @@ import javax.imageio.ImageIO; import java.awt.*; import java.awt.geom.AffineTransform; +import java.awt.geom.Arc2D; +import java.awt.geom.Ellipse2D; import java.awt.geom.Rectangle2D; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; @@ -21,6 +23,7 @@ public class SawBlade { private int spriteCounter = 0; private int spriteNum = 0; private float speed = 1f; + private boolean upsideDown; private boolean showHitbox = true; public SawBlade(float startX, float endX, float y, boolean upsideDown, Playing playing) { @@ -36,6 +39,7 @@ public SawBlade(float startX, float endX, float y, boolean upsideDown, Playing p } this.worldX = startX; this.worldY = y; + this.upsideDown = upsideDown; try { BufferedImage spriteSheet = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/sprites/saw-blade.png"))); @@ -98,9 +102,12 @@ public void draw(Graphics2D g2) { } } - public Rectangle2D.Float getScreenBounds() { - float screenX = this.worldX - playing.player.worldX + playing.player.screenX; - float screenY = this.worldY - playing.player.worldY + playing.player.screenY; - return new Rectangle2D.Float(screenX, screenY, spriteFrames[0].getWidth() * Constants.SCALE, spriteFrames[0].getHeight() * Constants.SCALE); + public Arc2D.Float getScreenBounds() { + float screenX = this.worldX - playing.camera.getCameraX(); + float screenY = this.worldY - playing.camera.getCameraY(); + screenY -= upsideDown ? spriteFrames[0].getHeight() * Constants.SCALE : 0; + float startingAngle = upsideDown ? 180f : 0f; + float extent = 180f; + return new Arc2D.Float(screenX, screenY, spriteFrames[0].getWidth() * Constants.SCALE, spriteFrames[0].getWidth() * Constants.SCALE, startingAngle, extent, Arc2D.PIE); } } From 73edd38b29553cc7d76f4cf16eaf040897a7aabd Mon Sep 17 00:00:00 2001 From: Drew Moore Date: Mon, 2 Jun 2025 17:37:50 -0400 Subject: [PATCH 03/21] New small sawblade sprite. Made existing sawblades smaller. --- src/main/java/com/drewm/objects/SawBlade.java | 8 ++++---- src/main/resources/maps/map1-lg.json | 2 +- src/main/resources/sprites/saw-blade-sm.png | Bin 0 -> 293 bytes 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/sprites/saw-blade-sm.png diff --git a/src/main/java/com/drewm/objects/SawBlade.java b/src/main/java/com/drewm/objects/SawBlade.java index 948de52..f40530c 100644 --- a/src/main/java/com/drewm/objects/SawBlade.java +++ b/src/main/java/com/drewm/objects/SawBlade.java @@ -42,15 +42,15 @@ public SawBlade(float startX, float endX, float y, boolean upsideDown, Playing p this.upsideDown = upsideDown; try { - BufferedImage spriteSheet = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/sprites/saw-blade.png"))); + BufferedImage spriteSheet = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/sprites/saw-blade-sm.png"))); this.spriteFrames = new BufferedImage[4]; for (int i = 0; i < spriteFrames.length; i++) { BufferedImage frame = spriteSheet.getSubimage( - i * Constants.TILE_WIDTH * 2, + i * Constants.TILE_WIDTH, 0, - Constants.TILE_WIDTH * 2, - Constants.TILE_WIDTH + Constants.TILE_WIDTH, + Constants.TILE_WIDTH / 2 ); if (upsideDown) { diff --git a/src/main/resources/maps/map1-lg.json b/src/main/resources/maps/map1-lg.json index 666b36f..63f066b 100644 --- a/src/main/resources/maps/map1-lg.json +++ b/src/main/resources/maps/map1-lg.json @@ -1422,7 +1422,7 @@ { "startX": 3440.0, "endX": 3760.0, - "y": 2000.0, + "y": 2040.0, "upsideDown": false }, { diff --git a/src/main/resources/sprites/saw-blade-sm.png b/src/main/resources/sprites/saw-blade-sm.png new file mode 100644 index 0000000000000000000000000000000000000000..2eabc989a4957c9fdf522e74bdab5165152ba1a0 GIT binary patch literal 293 zcmV+=0owkFP)Px#-$_J4R7i={l)VwdFbIX8bFRD!L#Xot-hv@qcnEL70_rpbtEf$igq;4I#7?DG zN$5TvaGVAdn&UFMk?stN!gqD#C Date: Mon, 2 Jun 2025 17:39:52 -0400 Subject: [PATCH 04/21] Removed old maps. Renamed main map. --- .../java/com/drewm/gamestates/Playing.java | 2 +- src/main/resources/maps/map0.json | 119 -- src/main/resources/maps/map1-lg.json | 1471 ---------------- src/main/resources/maps/map1.json | 1524 ++++++++++++++++- 4 files changed, 1460 insertions(+), 1656 deletions(-) delete mode 100644 src/main/resources/maps/map0.json delete mode 100644 src/main/resources/maps/map1-lg.json diff --git a/src/main/java/com/drewm/gamestates/Playing.java b/src/main/java/com/drewm/gamestates/Playing.java index 823d142..b76204f 100644 --- a/src/main/java/com/drewm/gamestates/Playing.java +++ b/src/main/java/com/drewm/gamestates/Playing.java @@ -19,7 +19,7 @@ import java.util.List; public class Playing implements Statemethods { - private String currentLevelFilePath = "/maps/map1-lg.json"; + private String currentLevelFilePath = "/maps/map1.json"; public List bullets = new ArrayList<>(); public LevelManager levelManager = new LevelManager(this); private final List explosions = new ArrayList<>(); diff --git a/src/main/resources/maps/map0.json b/src/main/resources/maps/map0.json deleted file mode 100644 index 8de53b4..0000000 --- a/src/main/resources/maps/map0.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "tiles": [ - [3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,4,5], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,6,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,6,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,6,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,6,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,6,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,1,1,1,1,1,1,1,1,1,1,1,19], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,15,15,15,15,15,15,15,15,15,15,15,5], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,1,1,1,2,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,15,15,15,16,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,0,1,1,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,14,15,15,16,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,11,11,11,11,11,11,11,0,1,1,1,1,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,3,15,15,15,15,16,11,11,11,11,11,11,11,14,15,15,15,15,16,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,0,1,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,0,1,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,17,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,17,1,1,1,1,1,1,1,1,1,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,3,4,4,4,4,4,4,4,4,4,4,4,4,5,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,9,13,11,11,11,11,0,1,1,1,1,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,17,18,18,18,18,18,19,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,9,11,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,17,2,11,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,17,2,11,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,17,2,11,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,17,2,11,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,17,2,11,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,17,2,11,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,17,2,11,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,17,2,11,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,17,2,11,11,11,12,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,17,2,11,11,14,4,4,4,4,4,4,4,4,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,17,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,7,8,8,8,8,8,8,8,8,8,8,8,17,1,1,1,1,1,1,1,1,1,1,2,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19] - ], - "players": [ - { - "type": "player", - "x": 2832.0, - "y": 96.0, - "health": 10, - "facingLeft": false - } - ], - "enemies": [ - { - "type": "enemy", - "x": 2832.0, - "y": 96.0, - "health": 30, - "facingLeft": false - }, - { - "type": "enemy", - "x": 2840.0, - "y": 96.0, - "health": 30, - "facingLeft": false - } - ], - "coins": [ - { - "x": 2640.0, - "y": 250.0 - }, - { - "x": 2592.0, - "y": 250.0 - }, - { - "x": 2640.0, - "y": 250.0 - }, - { - "x": 2592.0, - "y": 250.0 - }, - { - "x": 2640.0, - "y": 250.0 - }, - { - "x": 2592.0, - "y": 250.0 - } - ] -} \ No newline at end of file diff --git a/src/main/resources/maps/map1-lg.json b/src/main/resources/maps/map1-lg.json deleted file mode 100644 index 63f066b..0000000 --- a/src/main/resources/maps/map1-lg.json +++ /dev/null @@ -1,1471 +0,0 @@ -{ - "players": [ - { - "type": "player", - "x": 1520.0, - "y": 960.0, - "health": 10, - "facingLeft": false - } - ], - "rooms": [ - { - "tiles": [ - [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,3,4,4,4,4,4,4,4,5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,12,12,12,12,12,16,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,9,9], - [9,9,9,11,12,12,0,20,2,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,20,20,20,20,2,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,19,20,20,2,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,14,8,9,9,9,9,10,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,9,9,9,19,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,20,20,20,2,12,12,12,12,0,20,20,20,21,9,9,9,9,19,1,2,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,14,14,14,14,8,9,9,9,9,9,9,9,9,3,17,18,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,3,4,4,4,4,4,4,7,4,4,7,4,4,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,9,9,9,9,10,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,10,12,12,12,12,0,20,21,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,10,12,12,12,12,16,17,5,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,22,12,12,12,12,12,12,23,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,16,17,17,17,17,18,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,0,20,15,20,20,15,20,20,15,20,20,2,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,16,17,17,17,17,17,17,17,17,5,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,0,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,19,20,20,20,20,20,20,20,20,20,20,2,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,3,4,4,4,4,4,4,4,4,4,4,18,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,0,2,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,16,18,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,0,21,9,19,20,20,20,20,20,20,20,20,20,20,20,20,21,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,0,2,12,12,12,12,0,2,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,13,9,11,12,12,16,18,12,12,12,12,16,18,12,12,16,4,4,4,5,9,9,9,9,9,9,9,9,9,9,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13], - [9,9,9,11,12,12,13,9,11,12,12,12,12,12,0,2,12,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13], - [9,9,9,11,12,12,16,4,18,12,12,12,12,12,16,18,12,12,12,12,12,12,12,12,12,16,4,4,4,4,12,12,4,4,4,4,18,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13], - [9,9,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21], - [9,9,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], - [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9] - ], - "background": [ - [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4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,0,0,0,0,0,0,0,0,11,0,0,4], - [4,4,4,4,0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,1,1,4,4,4,4,4,0,0,0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,18,16,16,4], - [4,4,4,4,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], - [4,4,4,4,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], - [4,4,4,4,16,16,1,1,1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], - [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], - [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4] - ], - "enemies": [ - { - "type": "enemy", - "x": 800.0, - "y": 2240.0, - "health": 1, - "facingLeft": false - }, - { - "type": "enemy", - "x": 480.0, - "y": 3680.0, - "health": 1, - "facingLeft": false - }, - { - "type": "enemy", - "x": 1200.0, - "y": 3680.0, - "health": 1, - "facingLeft": false - }, - { - "type": "enemy", - "x": 2160.0, - "y": 3680.0, - "health": 1, - "facingLeft": false - }, - { - "type": "enemy", - "x": 2240.0, - "y": 2880.0, - "health": 1, - "facingLeft": false - } - ], - "collectables": [ - { - "x": 960.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 1120.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 960.0, - "y": 960.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 960.0, - "itemType": "COIN" - }, - { - "x": 1120.0, - "y": 960.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 960.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 960.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 960.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 800.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 800.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 800.0, - "itemType": "COIN" - }, - { - "x": 1600.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 1680.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 1760.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 2880.0, - "y": 960.0, - "itemType": "COIN" - }, - { - "x": 2960.0, - "y": 960.0, - "itemType": "COIN" - }, - { - "x": 3040.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 3120.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 3360.0, - "y": 880.0, - "itemType": "COIN" - }, - { - "x": 3520.0, - "y": 880.0, - "itemType": "COIN" - }, - { - "x": 3600.0, - "y": 880.0, - "itemType": "COIN" - }, - { - "x": 3520.0, - "y": 800.0, - "itemType": "COIN" - }, - { - "x": 3600.0, - "y": 800.0, - "itemType": "COIN" - }, - { - "x": 3520.0, - "y": 720.0, - "itemType": "COIN" - }, - { - "x": 3600.0, - "y": 720.0, - "itemType": "COIN" - }, - { - "x": 3840.0, - "y": 880.0, - "itemType": "COIN" - }, - { - "x": 3920.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 4000.0, - "y": 1040.0, - "itemType": "COIN" - }, - { - "x": 4240.0, - "y": 1360.0, - "itemType": "COIN" - }, - { - "x": 4320.0, - "y": 1360.0, - "itemType": "COIN" - }, - { - "x": 3440.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 3520.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 3600.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 3680.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 3760.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 3840.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 1760.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 1840.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2000.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2080.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2160.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2240.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2880.0, - "itemType": "COIN" - }, - { - "x": 2000.0, - "y": 2960.0, - "itemType": "COIN" - }, - { - "x": 1760.0, - "y": 1680.0, - "itemType": "COIN" - }, - { - "x": 1760.0, - "y": 1600.0, - "itemType": "COIN" - }, - { - "x": 1840.0, - "y": 1680.0, - "itemType": "COIN" - }, - { - "x": 1840.0, - "y": 1600.0, - "itemType": "COIN" - }, - { - "x": 1560.0, - "y": 1680.0, - "itemType": "COIN" - }, - { - "x": 1320.0, - "y": 1680.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1120.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1200.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1280.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1360.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1440.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1520.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1600.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1680.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 2000.0, - "itemType": "COIN" - }, - { - "x": 1200.0, - "y": 2000.0, - "itemType": "COIN" - }, - { - "x": 1360.0, - "y": 2000.0, - "itemType": "COIN" - }, - { - "x": 1520.0, - "y": 2000.0, - "itemType": "COIN" - }, - { - "x": 1680.0, - "y": 2000.0, - "itemType": "COIN" - }, - { - "x": 1160.0, - "y": 3160.0, - "itemType": "COIN" - }, - { - "x": 1160.0, - "y": 3080.0, - "itemType": "COIN" - }, - { - "x": 1160.0, - "y": 3000.0, - "itemType": "COIN" - }, - { - "x": 1160.0, - "y": 3240.0, - "itemType": "COIN" - }, - { - "x": 1160.0, - "y": 3320.0, - "itemType": "COIN" - }, - { - "x": 1080.0, - "y": 3160.0, - "itemType": "COIN" - }, - { - "x": 1240.0, - "y": 3160.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 2880.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 2960.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 3040.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 3120.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 3200.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 720.0, - "y": 3520.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 2880.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 2960.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 3040.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 3120.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 3200.0, - "itemType": "COIN" - }, - { - "x": 800.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 2880.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 2960.0, - "itemType": "COIN" - }, - { - "x": 880.0, - "y": 3040.0, - "itemType": "COIN" - }, - { - "x": 960.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 960.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 960.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 960.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 960.0, - "y": 2880.0, - "itemType": "COIN" - }, - { - "x": 960.0, - "y": 2960.0, - "itemType": "COIN" - }, - { - "x": 960.0, - "y": 3040.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 2880.0, - "itemType": "COIN" - }, - { - "x": 1040.0, - "y": 2960.0, - "itemType": "COIN" - }, - { - "x": 1680.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 1760.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 1840.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 1920.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 1680.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 1760.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 1840.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 1920.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2080.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2160.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 3280.0, - "itemType": "COIN" - }, - { - "x": 2080.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2160.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 3360.0, - "itemType": "COIN" - }, - { - "x": 2080.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2160.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2240.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2320.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2400.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2480.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2560.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2640.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2720.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 2800.0, - "y": 3440.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1120.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1200.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1280.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1360.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1440.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1520.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1600.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1680.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1760.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1840.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 1920.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2000.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2080.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2160.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2240.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2320.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2400.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2480.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2560.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2640.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2720.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2800.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2880.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 2960.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 3040.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 3120.0, - "itemType": "COIN" - }, - { - "x": 360.0, - "y": 3200.0, - "itemType": "COIN" - } - ], - "doors": [ - { - "x": 4320.0, - "y": 3440.0, - "destinationRoom": -1, - "destinationX": -1, - "destinationY": -1, - "lockType": "NONE", - "isGoal": true - } - ], - "floatingMines": [ - { - "startX": 3600.0, - "startY": 800.0, - "endX": 3600.0, - "endY": 560.0 - }, - { - "startX": 4080.0, - "startY": 1280.0, - "endX": 4240.0, - "endY": 960.0 - } - ], - "sawBlades": [ - { - "startX": 3440.0, - "endX": 3760.0, - "y": 2040.0, - "upsideDown": false - }, - { - "startX": 3760.0, - "endX": 3440.0, - "y": 1760.0, - "upsideDown": true - } - ], - "lasers": [ - { - "x1": 3920.0, - "y1": 1600.0, - "x2": 4400.0, - "y2": 1600.0, - "activationIntervalMS": 2000, - "delayMS": 0 - }, - { - "x1": 1680.0, - "y1": 1440.0, - "x2": 1680.0, - "y2": 1760.0, - "activationIntervalMS": 2000, - "delayMS": 0 - }, - { - "x1": 1440.0, - "y1": 1440.0, - "x2": 1440.0, - "y2": 1760.0, - "activationIntervalMS": 2000, - "delayMS": 1000 - }, - { - "x1": 1200.0, - "y1": 1440.0, - "x2": 1200.0, - "y2": 1760.0, - "activationIntervalMS": 2000, - "delayMS": 0 - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index d5bb9e1..63f066b 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -1,77 +1,1471 @@ { - "tiles": [ - [3,4,6,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5], - [10,11,6,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,6,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [10,11,6,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12], - [17,18,18,18,18,18,18,18,18,18,18,18,11,11,11,18,18,18,19], - [8,8,8,8,8,8,8,8,8,8,8,8,13,13,13,8,8,8,8], - [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8], - [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8], - [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8], - [8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8] - ], - "background": [ - [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], - [4,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,4], - [4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4], - [4,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,4], - [4,4,4,4,4,4,4,4,4,4,4,4,9,9,9,4,4,4,4], - [4,4,4,4,4,4,4,4,4,4,4,4,16,16,16,4,4,4,4], - [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], - [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], - [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], - [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4] - ], "players": [ { "type": "player", - "x": 192.0, - "y": 40.0, + "x": 1520.0, + "y": 960.0, "health": 10, "facingLeft": false } ], - "enemies": [ - { - "type": "enemy", - "x": 240.0, - "y": 40.0, - "health": 30, - "facingLeft": false - }, - { - "type": "enemy", - "x": 288.0, - "y": 40.0, - "health": 30, - "facingLeft": false - } - ], - "coins": [ - { - "x": 576.0, - "y": 144.0 - }, - { - "x": 624.0, - "y": 144.0 - }, - { - "x": 672.0, - "y": 144.0 - }, - { - "x": 720.0, - "y": 144.0 - }, - { - "x": 768.0, - "y": 144.0 - }, + "rooms": [ { - "x": 816.0, - "y": 144.0 + "tiles": [ + [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,3,4,4,4,4,4,4,4,5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,12,12,12,12,12,16,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,9,9], + [9,9,9,11,12,12,0,20,2,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,20,20,20,20,2,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,19,20,20,2,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,14,8,9,9,9,9,10,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,9,9,9,19,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,20,20,20,2,12,12,12,12,0,20,20,20,21,9,9,9,9,19,1,2,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,14,14,14,14,8,9,9,9,9,9,9,9,9,3,17,18,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,3,4,4,4,4,4,4,7,4,4,7,4,4,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,9,9,9,9,10,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,10,12,12,12,12,0,20,21,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,10,12,12,12,12,16,17,5,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,22,12,12,12,12,12,12,23,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,16,17,17,17,17,18,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,0,20,15,20,20,15,20,20,15,20,20,2,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,16,17,17,17,17,17,17,17,17,5,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,0,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,19,20,20,20,20,20,20,20,20,20,20,2,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,3,4,4,4,4,4,4,4,4,4,4,18,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,0,2,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,16,18,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,0,21,9,19,20,20,20,20,20,20,20,20,20,20,20,20,21,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,0,2,12,12,12,12,0,2,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,13,9,11,12,12,16,18,12,12,12,12,16,18,12,12,16,4,4,4,5,9,9,9,9,9,9,9,9,9,9,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13], + [9,9,9,11,12,12,13,9,11,12,12,12,12,12,0,2,12,12,12,12,12,12,12,12,12,13,12,12,12,12,12,12,12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13], + [9,9,9,11,12,12,16,4,18,12,12,12,12,12,16,18,12,12,12,12,12,12,12,12,12,16,4,4,4,4,12,12,4,4,4,4,18,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13], + [9,9,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21], + [9,9,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9], + [9,9,9,19,20,20,20,20,20,20,20,20,20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9,9,9,9,9,4,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,4], + [4,4,4,4,0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4], + [4,4,4,4,0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,16,16,16,16,16,16,16,16,16,16,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,4], + [4,4,4,4,0,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,1,1,4,4,4,4,4,0,0,0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,18,16,16,4], + [4,4,4,4,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,9,9,9,9,9,9,9,9,9,9,9,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], + [4,4,4,4,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], + [4,4,4,4,16,16,1,1,1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], + [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4], + [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4] + ], + "enemies": [ + { + "type": "enemy", + "x": 800.0, + "y": 2240.0, + "health": 1, + "facingLeft": false + }, + { + "type": "enemy", + "x": 480.0, + "y": 3680.0, + "health": 1, + "facingLeft": false + }, + { + "type": "enemy", + "x": 1200.0, + "y": 3680.0, + "health": 1, + "facingLeft": false + }, + { + "type": "enemy", + "x": 2160.0, + "y": 3680.0, + "health": 1, + "facingLeft": false + }, + { + "type": "enemy", + "x": 2240.0, + "y": 2880.0, + "health": 1, + "facingLeft": false + } + ], + "collectables": [ + { + "x": 960.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 1120.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 960.0, + "y": 960.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 960.0, + "itemType": "COIN" + }, + { + "x": 1120.0, + "y": 960.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 960.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 960.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 960.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 800.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 800.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 800.0, + "itemType": "COIN" + }, + { + "x": 1600.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 1680.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 1760.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 2880.0, + "y": 960.0, + "itemType": "COIN" + }, + { + "x": 2960.0, + "y": 960.0, + "itemType": "COIN" + }, + { + "x": 3040.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 3120.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 3360.0, + "y": 880.0, + "itemType": "COIN" + }, + { + "x": 3520.0, + "y": 880.0, + "itemType": "COIN" + }, + { + "x": 3600.0, + "y": 880.0, + "itemType": "COIN" + }, + { + "x": 3520.0, + "y": 800.0, + "itemType": "COIN" + }, + { + "x": 3600.0, + "y": 800.0, + "itemType": "COIN" + }, + { + "x": 3520.0, + "y": 720.0, + "itemType": "COIN" + }, + { + "x": 3600.0, + "y": 720.0, + "itemType": "COIN" + }, + { + "x": 3840.0, + "y": 880.0, + "itemType": "COIN" + }, + { + "x": 3920.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 4000.0, + "y": 1040.0, + "itemType": "COIN" + }, + { + "x": 4240.0, + "y": 1360.0, + "itemType": "COIN" + }, + { + "x": 4320.0, + "y": 1360.0, + "itemType": "COIN" + }, + { + "x": 3440.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 3520.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 3600.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 3680.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 3760.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 3840.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 1760.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 1840.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2000.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2080.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2160.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2240.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2880.0, + "itemType": "COIN" + }, + { + "x": 2000.0, + "y": 2960.0, + "itemType": "COIN" + }, + { + "x": 1760.0, + "y": 1680.0, + "itemType": "COIN" + }, + { + "x": 1760.0, + "y": 1600.0, + "itemType": "COIN" + }, + { + "x": 1840.0, + "y": 1680.0, + "itemType": "COIN" + }, + { + "x": 1840.0, + "y": 1600.0, + "itemType": "COIN" + }, + { + "x": 1560.0, + "y": 1680.0, + "itemType": "COIN" + }, + { + "x": 1320.0, + "y": 1680.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1120.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1200.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1280.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1360.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1440.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1520.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1600.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1680.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 2000.0, + "itemType": "COIN" + }, + { + "x": 1200.0, + "y": 2000.0, + "itemType": "COIN" + }, + { + "x": 1360.0, + "y": 2000.0, + "itemType": "COIN" + }, + { + "x": 1520.0, + "y": 2000.0, + "itemType": "COIN" + }, + { + "x": 1680.0, + "y": 2000.0, + "itemType": "COIN" + }, + { + "x": 1160.0, + "y": 3160.0, + "itemType": "COIN" + }, + { + "x": 1160.0, + "y": 3080.0, + "itemType": "COIN" + }, + { + "x": 1160.0, + "y": 3000.0, + "itemType": "COIN" + }, + { + "x": 1160.0, + "y": 3240.0, + "itemType": "COIN" + }, + { + "x": 1160.0, + "y": 3320.0, + "itemType": "COIN" + }, + { + "x": 1080.0, + "y": 3160.0, + "itemType": "COIN" + }, + { + "x": 1240.0, + "y": 3160.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 2880.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 2960.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 3040.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 3120.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 3200.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 720.0, + "y": 3520.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 2880.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 2960.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 3040.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 3120.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 3200.0, + "itemType": "COIN" + }, + { + "x": 800.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 2880.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 2960.0, + "itemType": "COIN" + }, + { + "x": 880.0, + "y": 3040.0, + "itemType": "COIN" + }, + { + "x": 960.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 960.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 960.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 960.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 960.0, + "y": 2880.0, + "itemType": "COIN" + }, + { + "x": 960.0, + "y": 2960.0, + "itemType": "COIN" + }, + { + "x": 960.0, + "y": 3040.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 2880.0, + "itemType": "COIN" + }, + { + "x": 1040.0, + "y": 2960.0, + "itemType": "COIN" + }, + { + "x": 1680.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 1760.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 1840.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 1920.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 1680.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 1760.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 1840.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 1920.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2080.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2160.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 3280.0, + "itemType": "COIN" + }, + { + "x": 2080.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2160.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 3360.0, + "itemType": "COIN" + }, + { + "x": 2080.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2160.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2240.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2320.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2400.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2480.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2560.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2640.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2720.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 2800.0, + "y": 3440.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1120.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1200.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1280.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1360.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1440.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1520.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1600.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1680.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1760.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1840.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 1920.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2000.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2080.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2160.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2240.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2320.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2400.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2480.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2560.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2640.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2720.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2800.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2880.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 2960.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 3040.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 3120.0, + "itemType": "COIN" + }, + { + "x": 360.0, + "y": 3200.0, + "itemType": "COIN" + } + ], + "doors": [ + { + "x": 4320.0, + "y": 3440.0, + "destinationRoom": -1, + "destinationX": -1, + "destinationY": -1, + "lockType": "NONE", + "isGoal": true + } + ], + "floatingMines": [ + { + "startX": 3600.0, + "startY": 800.0, + "endX": 3600.0, + "endY": 560.0 + }, + { + "startX": 4080.0, + "startY": 1280.0, + "endX": 4240.0, + "endY": 960.0 + } + ], + "sawBlades": [ + { + "startX": 3440.0, + "endX": 3760.0, + "y": 2040.0, + "upsideDown": false + }, + { + "startX": 3760.0, + "endX": 3440.0, + "y": 1760.0, + "upsideDown": true + } + ], + "lasers": [ + { + "x1": 3920.0, + "y1": 1600.0, + "x2": 4400.0, + "y2": 1600.0, + "activationIntervalMS": 2000, + "delayMS": 0 + }, + { + "x1": 1680.0, + "y1": 1440.0, + "x2": 1680.0, + "y2": 1760.0, + "activationIntervalMS": 2000, + "delayMS": 0 + }, + { + "x1": 1440.0, + "y1": 1440.0, + "x2": 1440.0, + "y2": 1760.0, + "activationIntervalMS": 2000, + "delayMS": 1000 + }, + { + "x1": 1200.0, + "y1": 1440.0, + "x2": 1200.0, + "y2": 1760.0, + "activationIntervalMS": 2000, + "delayMS": 0 + } + ] } ] } \ No newline at end of file From 63143ea83612918548d21cfd2c6da4d585bb77e6 Mon Sep 17 00:00:00 2001 From: Drew Moore Date: Mon, 2 Jun 2025 17:59:56 -0400 Subject: [PATCH 05/21] Created shell of a MovingPlatform class. --- .../com/drewm/objects/MovingPlatform.java | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/main/java/com/drewm/objects/MovingPlatform.java diff --git a/src/main/java/com/drewm/objects/MovingPlatform.java b/src/main/java/com/drewm/objects/MovingPlatform.java new file mode 100644 index 0000000..eab27a6 --- /dev/null +++ b/src/main/java/com/drewm/objects/MovingPlatform.java @@ -0,0 +1,67 @@ +package com.drewm.objects; + +import com.drewm.gamestates.Playing; +import com.drewm.utils.Constants; + +import java.awt.*; +import java.awt.geom.Rectangle2D; + +public class MovingPlatform { + private final Playing playing; + private float worldX, worldY; + private final float width, height; + private float speed; + private float min, max; + private boolean horizontal; + private boolean forward = true; + + public MovingPlatform(float worldX, float worldY, float width, float height, float speed, float min, float max, boolean horizontal, boolean forward, Playing playing) { + this.worldX = worldX; + this.worldY = worldY; + this.width = width; + this.height = height; + this.speed = speed; + this.min = min; + this.max = max; + this.horizontal = horizontal; + this.forward = forward; + this.playing = playing; + } + + public void update() { + + } + + public void draw(Graphics2D g2) { + float screenX = this.worldX - playing.camera.getCameraX(); + float screenY = this.worldY - playing.camera.getCameraY(); + if (screenX + Constants.TILE_SIZE * 2 > 0 && + screenX < Constants.SCREEN_WIDTH && + screenY + Constants.TILE_SIZE * 2 > 0 && + screenY < Constants.SCREEN_HEIGHT) { + g2.draw(getScreenBounds()); + } + } + + public Rectangle2D.Float getScreenBounds() { + float screenX = this.worldX - playing.camera.getCameraX(); + float screenY = this.worldY - playing.camera.getCameraY(); + return new Rectangle2D.Float(screenX, screenY, width * Constants.SCALE, height * Constants.SCALE); + } + + public float getWorldX() { + return worldX; + } + + public float getWorldY() { + return worldY; + } + + public float getSpeedX() { + return horizontal ? (forward ? speed : -speed) : 0; + } + + public float getSpeedY() { + return horizontal ? 0 : (forward ? speed : -speed); + } +} From d14c3d59e7ddde802174d6d0d96452c9aeec8fd2 Mon Sep 17 00:00:00 2001 From: Drew Moore Date: Mon, 2 Jun 2025 18:05:34 -0400 Subject: [PATCH 06/21] Created data records for moving platforms added moving platforms list to RoomData and level json. --- .../java/com/drewm/data/MovingPlatformData.java | 13 +++++++++++++ src/main/java/com/drewm/data/RoomData.java | 3 ++- src/main/resources/maps/map1.json | 12 ++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/drewm/data/MovingPlatformData.java diff --git a/src/main/java/com/drewm/data/MovingPlatformData.java b/src/main/java/com/drewm/data/MovingPlatformData.java new file mode 100644 index 0000000..c718471 --- /dev/null +++ b/src/main/java/com/drewm/data/MovingPlatformData.java @@ -0,0 +1,13 @@ +package com.drewm.data; + +public record MovingPlatformData( + float x, + float y, + float width, + float height, + float speed, + float min, + float max, + boolean movingHorizontal +) { +} diff --git a/src/main/java/com/drewm/data/RoomData.java b/src/main/java/com/drewm/data/RoomData.java index b951ab8..73438ae 100644 --- a/src/main/java/com/drewm/data/RoomData.java +++ b/src/main/java/com/drewm/data/RoomData.java @@ -10,6 +10,7 @@ public record RoomData( List doors, List floatingMines, List sawBlades, - List lasers + List lasers, + List movingPlatforms ) { } diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index 63f066b..032ab4e 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -1465,6 +1465,18 @@ "activationIntervalMS": 2000, "delayMS": 0 } + ], + "movingPlatforms": [ + { + "x": 0, + "y": 0, + "width": 0, + "height": 0, + "speed": 0, + "min": 0, + "max": 0, + "movingHorizontal": true + } ] } ] From 319de6badaddead8a21c235ae97c263f69f9a3fc Mon Sep 17 00:00:00 2001 From: Drew Moore Date: Mon, 2 Jun 2025 18:17:36 -0400 Subject: [PATCH 07/21] LevelManager now reads movingPlatforms from JSON into game state. Set up update and draw loops in Playing. --- .../java/com/drewm/gamestates/Playing.java | 8 ++++++++ .../java/com/drewm/levels/LevelManager.java | 9 ++++++++- src/main/java/com/drewm/levels/Room.java | 19 +++++++++++++++++-- .../com/drewm/objects/MovingPlatform.java | 3 +-- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/drewm/gamestates/Playing.java b/src/main/java/com/drewm/gamestates/Playing.java index b76204f..27d321e 100644 --- a/src/main/java/com/drewm/gamestates/Playing.java +++ b/src/main/java/com/drewm/gamestates/Playing.java @@ -149,6 +149,10 @@ public void update() { } } + for (MovingPlatform movingPlatform : this.levelManager.getCurrentRoom().getMovingPlatforms()) { + movingPlatform.update(); + } + } else { Modal activeModal = getActiveModal(); if (activeModal != null) activeModal.update(); @@ -189,6 +193,10 @@ public void draw(Graphics g) { explosion.draw(g2, camera.getCameraX(), camera.getCameraY()); } + for (MovingPlatform movingPlatform : this.levelManager.getCurrentRoom().getMovingPlatforms()) { + movingPlatform.draw(g2); + } + Modal activeModal = getActiveModal(); if (activeModal != null) activeModal.draw(g); } diff --git a/src/main/java/com/drewm/levels/LevelManager.java b/src/main/java/com/drewm/levels/LevelManager.java index 76835ec..e448de8 100644 --- a/src/main/java/com/drewm/levels/LevelManager.java +++ b/src/main/java/com/drewm/levels/LevelManager.java @@ -113,7 +113,14 @@ public void loadRooms(String filePath, boolean persistPlayerState) { lasers.add(new Laser(laser.x1(), laser.y1(), laser.x2(), laser.y2(), laser.activationIntervalMS(), laser.delayMS(), playing)); } - rooms.put(i, new Room(worldMap, roomNumTileWidth, roomNumTileHeight, worldBackground, basicZombies, collectables, doors, floatingMines, sawBlades, lasers)); + // Load moving platforms + List movingPlatformData = room.movingPlatforms(); + List movingPlatforms = new ArrayList<>(); + for (MovingPlatformData movingPlatform : movingPlatformData) { + movingPlatforms.add(new MovingPlatform(movingPlatform.x(), movingPlatform.y(), movingPlatform.width(), movingPlatform.height(), movingPlatform.speed(), movingPlatform.min(), movingPlatform.max(), movingPlatform.movingHorizontal(), playing)); + } + + rooms.put(i, new Room(worldMap, roomNumTileWidth, roomNumTileHeight, worldBackground, basicZombies, collectables, doors, floatingMines, sawBlades, lasers, movingPlatforms)); } } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/com/drewm/levels/Room.java b/src/main/java/com/drewm/levels/Room.java index 6f3d880..8108637 100644 --- a/src/main/java/com/drewm/levels/Room.java +++ b/src/main/java/com/drewm/levels/Room.java @@ -16,8 +16,20 @@ public class Room { private List floatingMines; private List sawBlades; private List lasers; - - public Room(int[][] worldMap, int roomNumTileWidth, int roomNumTileHeight, int[][] worldBackground, List basicZombies, List collectables, List doors, List floatingMines, List sawBlades, List lasers) { + private List movingPlatforms; + + public Room(int[][] worldMap, + int roomNumTileWidth, + int roomNumTileHeight, + int[][] worldBackground, + List basicZombies, + List collectables, + List doors, + List floatingMines, + List sawBlades, + List lasers, + List movingPlatforms + ) { this.worldMap = worldMap; this.worldBackground = worldBackground; this.basicZombies = basicZombies; @@ -26,6 +38,7 @@ public Room(int[][] worldMap, int roomNumTileWidth, int roomNumTileHeight, int[] this.floatingMines = floatingMines; this.sawBlades = sawBlades; this.lasers = lasers; + this.movingPlatforms = movingPlatforms; this.roomNumTileWidth = roomNumTileWidth; this.roomNumTileHeight = roomNumTileHeight; @@ -90,4 +103,6 @@ public int getRoomNumTileWidth() { public int getRoomNumTileHeight() { return roomNumTileHeight; } + + public List getMovingPlatforms() { return movingPlatforms; } } diff --git a/src/main/java/com/drewm/objects/MovingPlatform.java b/src/main/java/com/drewm/objects/MovingPlatform.java index eab27a6..ebd09a7 100644 --- a/src/main/java/com/drewm/objects/MovingPlatform.java +++ b/src/main/java/com/drewm/objects/MovingPlatform.java @@ -15,7 +15,7 @@ public class MovingPlatform { private boolean horizontal; private boolean forward = true; - public MovingPlatform(float worldX, float worldY, float width, float height, float speed, float min, float max, boolean horizontal, boolean forward, Playing playing) { + public MovingPlatform(float worldX, float worldY, float width, float height, float speed, float min, float max, boolean horizontal, Playing playing) { this.worldX = worldX; this.worldY = worldY; this.width = width; @@ -24,7 +24,6 @@ public MovingPlatform(float worldX, float worldY, float width, float height, flo this.min = min; this.max = max; this.horizontal = horizontal; - this.forward = forward; this.playing = playing; } From 649f87907d0c67afd01146b86e775d94315dd30c Mon Sep 17 00:00:00 2001 From: Drew Date: Fri, 6 Jun 2025 18:12:14 -0400 Subject: [PATCH 08/21] Cleaned up Entity update() code. --- src/main/java/com/drewm/entities/Entity.java | 90 +++++++++++--------- src/main/resources/maps/map1.json | 14 +-- 2 files changed, 59 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/drewm/entities/Entity.java b/src/main/java/com/drewm/entities/Entity.java index 6bc55a8..083f79b 100644 --- a/src/main/java/com/drewm/entities/Entity.java +++ b/src/main/java/com/drewm/entities/Entity.java @@ -18,7 +18,6 @@ public class Entity { public float velocityY = 0; - public boolean isSolid = false; public boolean useGravity = false; public boolean showHitbox = false; public boolean isOnGround = false; @@ -58,49 +57,17 @@ public Entity(float worldX, float worldY, BufferedImage[] movementSprites, int s } public void update(boolean jumpPressed) { - int feetY = (int) (worldY + hitboxOffsetY + hitboxHeight); - int leftX = (int) (worldX + hitboxOffsetX + 1); // small padding - int rightX = (int) (worldX + hitboxOffsetX + hitboxWidth - 1); - - this.isOnGround = playing.levelManager.isSolidTile(leftX, feetY + 1) || - playing.levelManager.isSolidTile(rightX, feetY + 1); - if (useGravity) { - if (velocityY < 0) { - velocityY += Constants.GRAVITY_ASCEND; - } else { - velocityY += Constants.GRAVITY_DESCEND; - } - - if (velocityY > Constants.TERMINAL_VELOCITY) { - velocityY = Constants.TERMINAL_VELOCITY; - } - } + applyGravity(); if (jumpPressed && isOnGround) { - velocityY = -jumpPower; + jump(); } - float nextWorldY = worldY + velocityY; - if (!isColliding((int) worldX, (int) nextWorldY)) { - worldY = nextWorldY; - screenY = Math.round(worldY - playing.camera.getCameraY()); - } else { - if (velocityY > 0) isOnGround = true; - velocityY = 0; - } + moveVertically(); + updateGroundStatus(); - if (isMoving) { - spriteCounter++; - if (spriteCounter > 12) { - if (spriteNum >= 7) { - spriteNum = 0; - } else { - spriteNum++; - } - spriteCounter = 0; - } - } + updateSpriteAnimation(); } @@ -118,6 +85,53 @@ public void draw(Graphics2D g2) { } } + private void updateGroundStatus() { + int feetY = (int) (worldY + hitboxOffsetY + hitboxHeight - 1); + int leftX = (int) (worldX + hitboxOffsetX + 1); // small padding + int rightX = (int) (worldX + hitboxOffsetX + hitboxWidth - 1); + + this.isOnGround = playing.levelManager.isSolidTile(leftX, feetY + 2) || + playing.levelManager.isSolidTile(rightX, feetY + 2); + } + + private void applyGravity() { + if (!useGravity || isOnGround) return; + + + velocityY += (velocityY < 0) ? Constants.GRAVITY_ASCEND : Constants.GRAVITY_DESCEND; + + if (velocityY > Constants.TERMINAL_VELOCITY) { + velocityY = Constants.TERMINAL_VELOCITY; + } + } + + private void jump() { + velocityY = -jumpPower; + isOnGround = false; + } + + private void moveVertically() { + float nextWorldY = worldY + velocityY; + + if (!isColliding((int) worldX, (int) nextWorldY)) { + worldY = nextWorldY; + } else { + if (velocityY > 0) isOnGround = true; + velocityY = 0; + } + screenY = Math.round(worldY - playing.camera.getCameraY()); + } + + private void updateSpriteAnimation() { + if (!isMoving) return; + + spriteCounter++; + if (spriteCounter > 12) { + spriteNum = (spriteNum + 1) % movementSprites.length; + spriteCounter = 0; + } + } + public Rectangle2D.Float getBounds() { return new Rectangle2D.Float(worldX + hitboxOffsetX, worldY + hitboxOffsetY, hitboxWidth, hitboxHeight); } diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index 032ab4e..d95ee56 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -2,8 +2,8 @@ "players": [ { "type": "player", - "x": 1520.0, - "y": 960.0, + "x": 2960.0, + "y": 1920.0, "health": 10, "facingLeft": false } @@ -1468,11 +1468,11 @@ ], "movingPlatforms": [ { - "x": 0, - "y": 0, - "width": 0, - "height": 0, - "speed": 0, + "x": 2800, + "y": 2080, + "width": 16, + "height": 4, + "speed": 1.0, "min": 0, "max": 0, "movingHorizontal": true From 572c866c08a433fceea46fe02e2995cc96cfb4ad Mon Sep 17 00:00:00 2001 From: Drew Date: Sun, 8 Jun 2025 16:57:32 -0400 Subject: [PATCH 09/21] Implemented MovingPlatform collision (no movement yet). Renamed object bounds methods to have consistency. MovingPlatform width is now scaled. --- .../java/com/drewm/entities/BasicZombie.java | 14 +---- src/main/java/com/drewm/entities/Entity.java | 61 +++++++++++++++++-- src/main/java/com/drewm/entities/Player.java | 9 +-- .../java/com/drewm/gamestates/Playing.java | 10 +-- .../java/com/drewm/objects/Collectable.java | 2 +- .../java/com/drewm/objects/FloatingMine.java | 2 +- .../com/drewm/objects/MovingPlatform.java | 32 ++++++++-- src/main/java/com/drewm/weapons/Bullet.java | 2 +- src/main/resources/maps/map1.json | 2 +- 9 files changed, 94 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/drewm/entities/BasicZombie.java b/src/main/java/com/drewm/entities/BasicZombie.java index 8d6d733..59e9d56 100644 --- a/src/main/java/com/drewm/entities/BasicZombie.java +++ b/src/main/java/com/drewm/entities/BasicZombie.java @@ -61,7 +61,7 @@ public void update() { this.facingLeft = !this.facingLeft; } - if (getBounds().intersects(playing.player.getBounds())) { + if (getScreenBounds().intersects(playing.player.getScreenBounds())) { playing.player.takeDamage(1); } } @@ -81,22 +81,12 @@ public void draw(Graphics2D g2) { } if (showHitbox) { - Rectangle2D.Float hitbox = getBounds(); + Rectangle2D.Float hitbox = getScreenBounds(); g2.setColor(Color.RED); g2.drawRect((int) hitbox.x, (int) hitbox.y, (int) hitbox.width, (int) hitbox.height); } } - public Rectangle2D.Float getBounds() { - float screenX = worldX - playing.player.worldX + playing.player.screenX; - float screenY = worldY - playing.player.worldY + playing.player.screenY; - return new Rectangle2D.Float(screenX + hitboxOffsetX, screenY + hitboxOffsetY, hitboxWidth, hitboxHeight); - } - - public Rectangle2D.Float getWorldBounds() { - return new Rectangle2D.Float(worldX + hitboxOffsetX, worldY + hitboxOffsetY, hitboxWidth, hitboxHeight); - } - public void handleDrop() { float dropChance = RANDOM.nextFloat(); diff --git a/src/main/java/com/drewm/entities/Entity.java b/src/main/java/com/drewm/entities/Entity.java index 083f79b..4e8af59 100644 --- a/src/main/java/com/drewm/entities/Entity.java +++ b/src/main/java/com/drewm/entities/Entity.java @@ -3,6 +3,7 @@ import com.drewm.gamestates.Playing; import com.drewm.levels.LevelManager; import com.drewm.main.Window; +import com.drewm.objects.MovingPlatform; import com.drewm.utils.Constants; import java.awt.*; @@ -12,6 +13,7 @@ public class Entity { protected final Playing playing; public float worldX, worldY; + private float previousWorldY; public int screenX, screenY; public int spriteWidth, spriteHeight; public int hitboxWidth, hitboxHeight, hitboxOffsetX, hitboxOffsetY; @@ -57,6 +59,7 @@ public Entity(float worldX, float worldY, BufferedImage[] movementSprites, int s } public void update(boolean jumpPressed) { + previousWorldY = worldY; applyGravity(); @@ -79,19 +82,38 @@ public void draw(Graphics2D g2) { } if (showHitbox) { - Rectangle2D.Float hitbox = getBounds(); + Rectangle2D.Float hitbox = getScreenBounds(); g2.setColor(Color.RED); g2.drawRect((int) hitbox.x, (int) hitbox.y, (int) hitbox.width, (int) hitbox.height); } } private void updateGroundStatus() { + // Check regular tiles int feetY = (int) (worldY + hitboxOffsetY + hitboxHeight - 1); - int leftX = (int) (worldX + hitboxOffsetX + 1); // small padding + int leftX = (int) (worldX + hitboxOffsetX + 1); int rightX = (int) (worldX + hitboxOffsetX + hitboxWidth - 1); - this.isOnGround = playing.levelManager.isSolidTile(leftX, feetY + 2) || + boolean onSolidTile = playing.levelManager.isSolidTile(leftX, feetY + 2) || playing.levelManager.isSolidTile(rightX, feetY + 2); + + // Check one-way platforms + boolean onOneWayPlatform = false; + Rectangle2D.Float entityBounds = getBounds(); + + for (MovingPlatform platform : playing.levelManager.getCurrentRoom().getMovingPlatforms()) { + float platformTop = platform.getWorldY(); + float entityBottom = entityBounds.y + entityBounds.height; + + if (Math.abs(entityBottom - platformTop) <= 2 && + entityBounds.x < platform.getWorldX() + platform.getBounds().width && + entityBounds.x + entityBounds.width > platform.getWorldX()) { + onOneWayPlatform = true; + break; + } + } + + this.isOnGround = onSolidTile || onOneWayPlatform; } private void applyGravity() { @@ -110,11 +132,36 @@ private void jump() { isOnGround = false; } + private MovingPlatform checkOneWayPlatformCollision(float nextWorldY) { + Rectangle2D.Float nextBounds = new Rectangle2D.Float( + worldX + hitboxOffsetX, + nextWorldY + hitboxOffsetY, + hitboxWidth, + hitboxHeight + ); + + for (MovingPlatform platform : playing.levelManager.getCurrentRoom().getMovingPlatforms()) { + if (platform.canLandOn(nextBounds, velocityY, previousWorldY + hitboxOffsetY)) { + return platform; + } + } + + return null; + } + private void moveVertically() { float nextWorldY = worldY + velocityY; - if (!isColliding((int) worldX, (int) nextWorldY)) { - worldY = nextWorldY; + if (!isColliding((int) worldX, Math.round(nextWorldY))) { + MovingPlatform platform = checkOneWayPlatformCollision(nextWorldY); + + if (platform != null) { + worldY = platform.getLandingY() - (hitboxOffsetY + hitboxHeight); + velocityY = 0; + isOnGround = true; + } else { + worldY = nextWorldY; + } } else { if (velocityY > 0) isOnGround = true; velocityY = 0; @@ -136,6 +183,10 @@ public Rectangle2D.Float getBounds() { return new Rectangle2D.Float(worldX + hitboxOffsetX, worldY + hitboxOffsetY, hitboxWidth, hitboxHeight); } + public Rectangle2D.Float getScreenBounds() { + return new Rectangle2D.Float(screenX + hitboxOffsetX, screenY + hitboxOffsetY, hitboxWidth, hitboxHeight); + } + public boolean isColliding(int worldX, int worldY) { LevelManager levelManager = Window.getWindow().playing.levelManager; diff --git a/src/main/java/com/drewm/entities/Player.java b/src/main/java/com/drewm/entities/Player.java index e906b03..9cb9b2b 100644 --- a/src/main/java/com/drewm/entities/Player.java +++ b/src/main/java/com/drewm/entities/Player.java @@ -18,7 +18,7 @@ public class Player extends Entity { public boolean leftPressed, rightPressed, jumpPressed; private int coinMultiplier = 1; - private int coins = 1000; + private int coins = 100000; private int maxHealth = Constants.PLAYER_STARTING_MAX_HEALTH; private int health = maxHealth; private float speed = Constants.PLAYER_STARTING_SPEED; @@ -126,11 +126,6 @@ public void update() { } } - @Override - public Rectangle2D.Float getBounds() { - return new Rectangle2D.Float(screenX + hitboxOffsetX, screenY + hitboxOffsetY, hitboxWidth, hitboxHeight); - } - public void draw(Graphics2D g2) { if (facingLeft) { g2.drawImage(this.movementSprites[spriteNum], this.screenX + this.spriteWidth * Constants.SCALE, this.screenY, this.spriteWidth * -Constants.SCALE, this.spriteHeight * Constants.SCALE, null); @@ -139,7 +134,7 @@ public void draw(Graphics2D g2) { } if (showHitbox) { - Rectangle2D.Float rect = getBounds(); + Rectangle2D.Float rect = getScreenBounds(); g2.setColor(Color.RED); g2.drawRect((int) rect.x, (int) rect.y, (int) rect.width, (int) rect.height); } diff --git a/src/main/java/com/drewm/gamestates/Playing.java b/src/main/java/com/drewm/gamestates/Playing.java index 27d321e..8f13e45 100644 --- a/src/main/java/com/drewm/gamestates/Playing.java +++ b/src/main/java/com/drewm/gamestates/Playing.java @@ -110,7 +110,7 @@ public void update() { currentDoor = null; for (Door door : this.levelManager.getCurrentRoom().getDoors()) { - if (door.getScreenBounds().intersects(player.getBounds())) { + if (door.getScreenBounds().intersects(player.getScreenBounds())) { currentDoor = door; break; } @@ -128,14 +128,14 @@ public void update() { for (SawBlade sawBlade : this.levelManager.getCurrentRoom().getSawBlades()) { sawBlade.update(); - if (sawBlade.getScreenBounds().intersects(player.getBounds())) { + if (sawBlade.getScreenBounds().intersects(player.getScreenBounds())) { player.takeDamage(1); } } for (Laser laser : this.levelManager.getCurrentRoom().getLasers()) { laser.update(); - if (laser.isActive() && laser.getScreenBounds().intersects(player.getBounds())) { + if (laser.isActive() && laser.getScreenBounds().intersects(player.getScreenBounds())) { player.takeDamage(1); } } @@ -149,10 +149,6 @@ public void update() { } } - for (MovingPlatform movingPlatform : this.levelManager.getCurrentRoom().getMovingPlatforms()) { - movingPlatform.update(); - } - } else { Modal activeModal = getActiveModal(); if (activeModal != null) activeModal.update(); diff --git a/src/main/java/com/drewm/objects/Collectable.java b/src/main/java/com/drewm/objects/Collectable.java index 5cd03bd..ef970e4 100644 --- a/src/main/java/com/drewm/objects/Collectable.java +++ b/src/main/java/com/drewm/objects/Collectable.java @@ -48,7 +48,7 @@ public Collectable(float x, float y, ItemType type, Playing playing) { } public boolean update() { - if (getScreenBounds().intersects(playing.player.getBounds())) { + if (getScreenBounds().intersects(playing.player.getScreenBounds())) { switch(itemType) { case COIN -> playing.player.earnCoins(playing.player.getCoinMultiplier()); case KEYCARD -> { diff --git a/src/main/java/com/drewm/objects/FloatingMine.java b/src/main/java/com/drewm/objects/FloatingMine.java index af1fa05..95ef453 100644 --- a/src/main/java/com/drewm/objects/FloatingMine.java +++ b/src/main/java/com/drewm/objects/FloatingMine.java @@ -52,7 +52,7 @@ public FloatingMine(float startX, float startY, float endX, float endY, Playing } public boolean update() { - if (getScreenBounds().intersects(playing.player.getBounds())) { + if (getScreenBounds().intersects(playing.player.getScreenBounds())) { return true; } worldX += directionX * speed; diff --git a/src/main/java/com/drewm/objects/MovingPlatform.java b/src/main/java/com/drewm/objects/MovingPlatform.java index ebd09a7..6ac695d 100644 --- a/src/main/java/com/drewm/objects/MovingPlatform.java +++ b/src/main/java/com/drewm/objects/MovingPlatform.java @@ -27,10 +27,6 @@ public MovingPlatform(float worldX, float worldY, float width, float height, flo this.playing = playing; } - public void update() { - - } - public void draw(Graphics2D g2) { float screenX = this.worldX - playing.camera.getCameraX(); float screenY = this.worldY - playing.camera.getCameraY(); @@ -42,10 +38,36 @@ public void draw(Graphics2D g2) { } } + public boolean canLandOn(Rectangle2D.Float entityBounds, float entityVelocityY, float entityPreviousY) { + if (entityVelocityY <= 0) { + return false; + } + + if (entityBounds.x + entityBounds.width <= worldX || entityBounds.x >= worldX + width) { + return false; + } + + float entityBottom = entityBounds.y + entityBounds.height; + float entityPreviousBottom = entityPreviousY + entityBounds.height; + float platformTop = worldY; + + return entityPreviousBottom <= platformTop && + entityBottom >= platformTop && + entityBottom <= platformTop + height; + } + + public float getLandingY() { + return worldY; + } + + public Rectangle2D.Float getBounds() { + return new Rectangle2D.Float(worldX, worldY, width, height); + } + public Rectangle2D.Float getScreenBounds() { float screenX = this.worldX - playing.camera.getCameraX(); float screenY = this.worldY - playing.camera.getCameraY(); - return new Rectangle2D.Float(screenX, screenY, width * Constants.SCALE, height * Constants.SCALE); + return new Rectangle2D.Float(screenX, screenY, width, height * Constants.SCALE); } public float getWorldX() { diff --git a/src/main/java/com/drewm/weapons/Bullet.java b/src/main/java/com/drewm/weapons/Bullet.java index 2548ba3..c3dd671 100644 --- a/src/main/java/com/drewm/weapons/Bullet.java +++ b/src/main/java/com/drewm/weapons/Bullet.java @@ -61,7 +61,7 @@ public boolean update(List zombies) { } for (BasicZombie zombie : zombies) { - if (getWorldBounds().intersects(zombie.getWorldBounds())) { + if (getWorldBounds().intersects(zombie.getBounds())) { zombie.takeDamage(damage); return true; } diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index d95ee56..7dd2b6c 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -1470,7 +1470,7 @@ { "x": 2800, "y": 2080, - "width": 16, + "width": 80, "height": 4, "speed": 1.0, "min": 0, From e0ced46fccb0f63390589d71af067a107ebaba67 Mon Sep 17 00:00:00 2001 From: Drew Date: Mon, 9 Jun 2025 02:12:36 -0400 Subject: [PATCH 10/21] Changed data structure for moving platforms in level json. --- .../com/drewm/data/MovingPlatformData.java | 11 +++---- .../java/com/drewm/gamestates/Playing.java | 4 +++ .../java/com/drewm/levels/LevelManager.java | 2 +- .../java/com/drewm/objects/FloatingMine.java | 1 - .../com/drewm/objects/MovingPlatform.java | 31 +++++++++---------- src/main/resources/maps/map1.json | 11 +++---- 6 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/drewm/data/MovingPlatformData.java b/src/main/java/com/drewm/data/MovingPlatformData.java index c718471..e2b010b 100644 --- a/src/main/java/com/drewm/data/MovingPlatformData.java +++ b/src/main/java/com/drewm/data/MovingPlatformData.java @@ -1,13 +1,12 @@ package com.drewm.data; public record MovingPlatformData( - float x, - float y, + float startX, + float startY, + float endX, + float endY, float width, float height, - float speed, - float min, - float max, - boolean movingHorizontal + float speed ) { } diff --git a/src/main/java/com/drewm/gamestates/Playing.java b/src/main/java/com/drewm/gamestates/Playing.java index 8f13e45..16f724e 100644 --- a/src/main/java/com/drewm/gamestates/Playing.java +++ b/src/main/java/com/drewm/gamestates/Playing.java @@ -140,6 +140,10 @@ public void update() { } } + for (MovingPlatform movingPlatform : this.levelManager.getCurrentRoom().getMovingPlatforms()) { + movingPlatform.update(); + } + Iterator explosionIterator = explosions.iterator(); while (explosionIterator.hasNext()) { Explosion explosion = explosionIterator.next(); diff --git a/src/main/java/com/drewm/levels/LevelManager.java b/src/main/java/com/drewm/levels/LevelManager.java index e448de8..0fefa2f 100644 --- a/src/main/java/com/drewm/levels/LevelManager.java +++ b/src/main/java/com/drewm/levels/LevelManager.java @@ -117,7 +117,7 @@ public void loadRooms(String filePath, boolean persistPlayerState) { List movingPlatformData = room.movingPlatforms(); List movingPlatforms = new ArrayList<>(); for (MovingPlatformData movingPlatform : movingPlatformData) { - movingPlatforms.add(new MovingPlatform(movingPlatform.x(), movingPlatform.y(), movingPlatform.width(), movingPlatform.height(), movingPlatform.speed(), movingPlatform.min(), movingPlatform.max(), movingPlatform.movingHorizontal(), playing)); + movingPlatforms.add(new MovingPlatform(movingPlatform.startX(), movingPlatform.startY(), movingPlatform.endX(), movingPlatform.endY(), movingPlatform.width(), movingPlatform.height(), movingPlatform.speed(), playing)); } rooms.put(i, new Room(worldMap, roomNumTileWidth, roomNumTileHeight, worldBackground, basicZombies, collectables, doors, floatingMines, sawBlades, lasers, movingPlatforms)); diff --git a/src/main/java/com/drewm/objects/FloatingMine.java b/src/main/java/com/drewm/objects/FloatingMine.java index 95ef453..e2d23ff 100644 --- a/src/main/java/com/drewm/objects/FloatingMine.java +++ b/src/main/java/com/drewm/objects/FloatingMine.java @@ -6,7 +6,6 @@ import javax.imageio.ImageIO; import java.awt.*; import java.awt.geom.Ellipse2D; -import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.Objects; diff --git a/src/main/java/com/drewm/objects/MovingPlatform.java b/src/main/java/com/drewm/objects/MovingPlatform.java index 6ac695d..9ad53ba 100644 --- a/src/main/java/com/drewm/objects/MovingPlatform.java +++ b/src/main/java/com/drewm/objects/MovingPlatform.java @@ -9,24 +9,29 @@ public class MovingPlatform { private final Playing playing; private float worldX, worldY; + private float startX, startY, endX, endY; + private float directionX, directionY; + private boolean movingToEnd = true; private final float width, height; private float speed; - private float min, max; - private boolean horizontal; - private boolean forward = true; - public MovingPlatform(float worldX, float worldY, float width, float height, float speed, float min, float max, boolean horizontal, Playing playing) { - this.worldX = worldX; - this.worldY = worldY; + public MovingPlatform(float startX, float startY, float endX, float endY, float width, float height, float speed, Playing playing) { + this.startX = startX; + this.startY = startY; + this.endX = endX; + this.endY = endY; + this.worldX = startX; + this.worldY = startY; this.width = width; this.height = height; this.speed = speed; - this.min = min; - this.max = max; - this.horizontal = horizontal; this.playing = playing; } + public void update() { + + } + public void draw(Graphics2D g2) { float screenX = this.worldX - playing.camera.getCameraX(); float screenY = this.worldY - playing.camera.getCameraY(); @@ -77,12 +82,4 @@ public float getWorldX() { public float getWorldY() { return worldY; } - - public float getSpeedX() { - return horizontal ? (forward ? speed : -speed) : 0; - } - - public float getSpeedY() { - return horizontal ? 0 : (forward ? speed : -speed); - } } diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index 7dd2b6c..83cab94 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -1468,14 +1468,13 @@ ], "movingPlatforms": [ { - "x": 2800, - "y": 2080, + "startX": 2800, + "startY": 2080, + "endX": 2400, + "endY": 2080, "width": 80, "height": 4, - "speed": 1.0, - "min": 0, - "max": 0, - "movingHorizontal": true + "speed": 0.2 } ] } From c9844f4db34a9f3b634b81ae257d831ea1ae8967 Mon Sep 17 00:00:00 2001 From: Drew Date: Mon, 9 Jun 2025 02:23:50 -0400 Subject: [PATCH 11/21] Platforms now move. --- .../com/drewm/objects/MovingPlatform.java | 30 +++++++++++++++++++ src/main/resources/maps/map1.json | 11 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/drewm/objects/MovingPlatform.java b/src/main/java/com/drewm/objects/MovingPlatform.java index 9ad53ba..c395d82 100644 --- a/src/main/java/com/drewm/objects/MovingPlatform.java +++ b/src/main/java/com/drewm/objects/MovingPlatform.java @@ -26,10 +26,23 @@ public MovingPlatform(float startX, float startY, float endX, float endY, float this.height = height; this.speed = speed; this.playing = playing; + + calculateDirection(); } public void update() { + worldX += directionX * speed; + worldY += directionY * speed; + + float targetX = movingToEnd ? endX : startX; + float targetY = movingToEnd ? endY : startY; + if (distanceTo(targetX, targetY) < speed) { + worldX = targetX; + worldY = targetY; + movingToEnd = !movingToEnd; + calculateDirection(); + } } public void draw(Graphics2D g2) { @@ -82,4 +95,21 @@ public float getWorldX() { public float getWorldY() { return worldY; } + + private float distanceTo(float targetX, float targetY) { + float dx = targetX - worldX; + float dy = targetY - worldY; + return (float) Math.sqrt(dx * dx + dy * dy); + } + + private void calculateDirection() { + float dx = (movingToEnd ? endX - worldX : startX - worldX); + float dy = (movingToEnd ? endY - worldY : startY - worldY); + float distance = (float) Math.sqrt(dx * dx + dy * dy); + + if (distance != 0) { + directionX = dx / distance; + directionY = dy / distance; + } + } } diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index 83cab94..2d098e1 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -1474,7 +1474,16 @@ "endY": 2080, "width": 80, "height": 4, - "speed": 0.2 + "speed": 0.5 + }, + { + "startX": 2080, + "startY": 2080, + "endX": 2080, + "endY": 2960, + "width": 80, + "height": 4, + "speed": 0.5 } ] } From 0f5aacfb877eaf60017be847389198695926a3a5 Mon Sep 17 00:00:00 2001 From: Drew Date: Sat, 14 Jun 2025 02:27:22 -0400 Subject: [PATCH 12/21] Player now moves with the platform. --- src/main/java/com/drewm/entities/Entity.java | 79 +++++++++++++++++--- 1 file changed, 67 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/drewm/entities/Entity.java b/src/main/java/com/drewm/entities/Entity.java index 4e8af59..d4e9c8a 100644 --- a/src/main/java/com/drewm/entities/Entity.java +++ b/src/main/java/com/drewm/entities/Entity.java @@ -28,6 +28,10 @@ public class Entity { public float jumpPower = Constants.STARTING_JUMP_FORCE; public int health = 100; + private MovingPlatform ridingPlatform = null; + private float lastPlatformX = 0; + private float lastPlatformY = 0; + BufferedImage[] movementSprites; public int spriteCounter = 0; public int spriteNum = 0; @@ -68,12 +72,37 @@ public void update(boolean jumpPressed) { } moveVertically(); + updateGroundStatus(); + if (ridingPlatform != null && isOnGround) { + float currentPlatformX = ridingPlatform.getWorldX(); + float currentPlatformY = ridingPlatform.getWorldY(); + + if (lastPlatformX != 0 || lastPlatformY != 0) { + float platformDeltaX = currentPlatformX - lastPlatformX; + float platformDeltaY = currentPlatformY - lastPlatformY; + + worldX += platformDeltaX; + worldY += platformDeltaY; + } + + float platformTop = ridingPlatform.getWorldY(); + float desiredY = platformTop - (hitboxOffsetY + hitboxHeight); + worldY = desiredY; + + lastPlatformX = currentPlatformX; + lastPlatformY = currentPlatformY; + } else { + lastPlatformX = 0; + lastPlatformY = 0; + } + + screenY = Math.round(worldY - playing.camera.getCameraY()); + updateSpriteAnimation(); } - public void draw(Graphics2D g2) { if (facingLeft) { g2.drawImage(this.movementSprites[spriteNum], (int)(this.worldX + this.spriteWidth * Constants.SCALE), (int) this.worldY, this.spriteWidth * -Constants.SCALE, this.spriteHeight * Constants.SCALE, null); @@ -89,7 +118,6 @@ public void draw(Graphics2D g2) { } private void updateGroundStatus() { - // Check regular tiles int feetY = (int) (worldY + hitboxOffsetY + hitboxHeight - 1); int leftX = (int) (worldX + hitboxOffsetX + 1); int rightX = (int) (worldX + hitboxOffsetX + hitboxWidth - 1); @@ -97,29 +125,49 @@ private void updateGroundStatus() { boolean onSolidTile = playing.levelManager.isSolidTile(leftX, feetY + 2) || playing.levelManager.isSolidTile(rightX, feetY + 2); - // Check one-way platforms - boolean onOneWayPlatform = false; + MovingPlatform platformBelow = findPlatformBelow(); + + if (platformBelow != null) { + ridingPlatform = platformBelow; + isOnGround = true; + } else if (onSolidTile) { + ridingPlatform = null; + isOnGround = true; + } else { + ridingPlatform = null; + isOnGround = false; + } + } + + private MovingPlatform findPlatformBelow() { Rectangle2D.Float entityBounds = getBounds(); + float entityBottom = entityBounds.y + entityBounds.height; + + if (ridingPlatform != null) { + float platformTop = ridingPlatform.getWorldY(); + if (Math.abs(entityBottom - platformTop) <= 3 && + entityBounds.x < ridingPlatform.getWorldX() + ridingPlatform.getBounds().width && + entityBounds.x + entityBounds.width > ridingPlatform.getWorldX()) { + return ridingPlatform; + } + } for (MovingPlatform platform : playing.levelManager.getCurrentRoom().getMovingPlatforms()) { float platformTop = platform.getWorldY(); - float entityBottom = entityBounds.y + entityBounds.height; - if (Math.abs(entityBottom - platformTop) <= 2 && + if (Math.abs(entityBottom - platformTop) <= 3 && entityBounds.x < platform.getWorldX() + platform.getBounds().width && entityBounds.x + entityBounds.width > platform.getWorldX()) { - onOneWayPlatform = true; - break; + return platform; } } - this.isOnGround = onSolidTile || onOneWayPlatform; + return null; } private void applyGravity() { if (!useGravity || isOnGround) return; - velocityY += (velocityY < 0) ? Constants.GRAVITY_ASCEND : Constants.GRAVITY_DESCEND; if (velocityY > Constants.TERMINAL_VELOCITY) { @@ -130,6 +178,9 @@ private void applyGravity() { private void jump() { velocityY = -jumpPower; isOnGround = false; + ridingPlatform = null; + lastPlatformX = 0; + lastPlatformY = 0; } private MovingPlatform checkOneWayPlatformCollision(float nextWorldY) { @@ -150,6 +201,10 @@ private MovingPlatform checkOneWayPlatformCollision(float nextWorldY) { } private void moveVertically() { + if (ridingPlatform != null && isOnGround) { + return; + } + float nextWorldY = worldY + velocityY; if (!isColliding((int) worldX, Math.round(nextWorldY))) { @@ -159,6 +214,7 @@ private void moveVertically() { worldY = platform.getLandingY() - (hitboxOffsetY + hitboxHeight); velocityY = 0; isOnGround = true; + ridingPlatform = platform; } else { worldY = nextWorldY; } @@ -166,7 +222,6 @@ private void moveVertically() { if (velocityY > 0) isOnGround = true; velocityY = 0; } - screenY = Math.round(worldY - playing.camera.getCameraY()); } private void updateSpriteAnimation() { @@ -212,4 +267,4 @@ public boolean isStandingOnSpike(int worldX, int worldY) { public void takeDamage(int amount) { this.health -= amount; } -} +} \ No newline at end of file From 60a691a5b3c08193ce3365f5faa6df27ce602d8b Mon Sep 17 00:00:00 2001 From: Drew Date: Sat, 14 Jun 2025 02:45:36 -0400 Subject: [PATCH 13/21] Simplified some of the logic. --- src/main/java/com/drewm/entities/Entity.java | 27 +++---------------- .../com/drewm/objects/MovingPlatform.java | 16 ++++++++++- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/drewm/entities/Entity.java b/src/main/java/com/drewm/entities/Entity.java index d4e9c8a..c1ee1f7 100644 --- a/src/main/java/com/drewm/entities/Entity.java +++ b/src/main/java/com/drewm/entities/Entity.java @@ -29,8 +29,6 @@ public class Entity { public int health = 100; private MovingPlatform ridingPlatform = null; - private float lastPlatformX = 0; - private float lastPlatformY = 0; BufferedImage[] movementSprites; public int spriteCounter = 0; @@ -76,26 +74,9 @@ public void update(boolean jumpPressed) { updateGroundStatus(); if (ridingPlatform != null && isOnGround) { - float currentPlatformX = ridingPlatform.getWorldX(); - float currentPlatformY = ridingPlatform.getWorldY(); - - if (lastPlatformX != 0 || lastPlatformY != 0) { - float platformDeltaX = currentPlatformX - lastPlatformX; - float platformDeltaY = currentPlatformY - lastPlatformY; - - worldX += platformDeltaX; - worldY += platformDeltaY; - } - - float platformTop = ridingPlatform.getWorldY(); - float desiredY = platformTop - (hitboxOffsetY + hitboxHeight); - worldY = desiredY; - - lastPlatformX = currentPlatformX; - lastPlatformY = currentPlatformY; - } else { - lastPlatformX = 0; - lastPlatformY = 0; + worldX += ridingPlatform.getDeltaX(); + worldY += ridingPlatform.getDeltaY(); + worldY = ridingPlatform.getLandingY() - (hitboxOffsetY + hitboxHeight); } screenY = Math.round(worldY - playing.camera.getCameraY()); @@ -179,8 +160,6 @@ private void jump() { velocityY = -jumpPower; isOnGround = false; ridingPlatform = null; - lastPlatformX = 0; - lastPlatformY = 0; } private MovingPlatform checkOneWayPlatformCollision(float nextWorldY) { diff --git a/src/main/java/com/drewm/objects/MovingPlatform.java b/src/main/java/com/drewm/objects/MovingPlatform.java index c395d82..f044082 100644 --- a/src/main/java/com/drewm/objects/MovingPlatform.java +++ b/src/main/java/com/drewm/objects/MovingPlatform.java @@ -9,7 +9,8 @@ public class MovingPlatform { private final Playing playing; private float worldX, worldY; - private float startX, startY, endX, endY; + private float prevWorldX, prevWorldY; + private final float startX, startY, endX, endY; private float directionX, directionY; private boolean movingToEnd = true; private final float width, height; @@ -22,6 +23,8 @@ public MovingPlatform(float startX, float startY, float endX, float endY, float this.endY = endY; this.worldX = startX; this.worldY = startY; + this.prevWorldX = startX; + this.prevWorldY = startY; this.width = width; this.height = height; this.speed = speed; @@ -31,6 +34,9 @@ public MovingPlatform(float startX, float startY, float endX, float endY, float } public void update() { + prevWorldX = worldX; + prevWorldY = worldY; + worldX += directionX * speed; worldY += directionY * speed; @@ -96,6 +102,14 @@ public float getWorldY() { return worldY; } + public float getDeltaX() { + return worldX - prevWorldX; + } + + public float getDeltaY() { + return worldY - prevWorldY; + } + private float distanceTo(float targetX, float targetY) { float dx = targetX - worldX; float dy = targetY - worldY; From 5184604e16855d2f0a5aa662cd200abd8b198d01 Mon Sep 17 00:00:00 2001 From: Drew Date: Sat, 14 Jun 2025 03:05:59 -0400 Subject: [PATCH 14/21] Wider platforms. Platforms now have color. --- src/main/java/com/drewm/objects/MovingPlatform.java | 12 +++++++++++- src/main/resources/maps/map1.json | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/drewm/objects/MovingPlatform.java b/src/main/java/com/drewm/objects/MovingPlatform.java index f044082..08e4b16 100644 --- a/src/main/java/com/drewm/objects/MovingPlatform.java +++ b/src/main/java/com/drewm/objects/MovingPlatform.java @@ -58,7 +58,17 @@ public void draw(Graphics2D g2) { screenX < Constants.SCREEN_WIDTH && screenY + Constants.TILE_SIZE * 2 > 0 && screenY < Constants.SCREEN_HEIGHT) { - g2.draw(getScreenBounds()); + g2.setColor(Color.DARK_GRAY); + g2.fill(getScreenBounds()); + g2.setColor(Color.LIGHT_GRAY); + g2.setStroke(new BasicStroke(4)); + Rectangle2D.Float bounds = getScreenBounds(); + g2.draw(new Rectangle2D.Float( + bounds.x + 4f / 2f, + bounds.y + 4f / 2f, + bounds.width - 4f, + bounds.height - 4f + )); } } diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index 2d098e1..48a68fb 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -1472,7 +1472,7 @@ "startY": 2080, "endX": 2400, "endY": 2080, - "width": 80, + "width": 160, "height": 4, "speed": 0.5 }, @@ -1481,7 +1481,7 @@ "startY": 2080, "endX": 2080, "endY": 2960, - "width": 80, + "width": 160, "height": 4, "speed": 0.5 } From e136de739c8b2070b6187d8136c3600f66f6329c Mon Sep 17 00:00:00 2001 From: Drew Date: Sat, 14 Jun 2025 03:15:51 -0400 Subject: [PATCH 15/21] Hid player hitbox. Moved player starting point. Increased speed of platforms. --- src/main/java/com/drewm/entities/Player.java | 2 +- src/main/resources/maps/map1.json | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/drewm/entities/Player.java b/src/main/java/com/drewm/entities/Player.java index 9cb9b2b..d1a864b 100644 --- a/src/main/java/com/drewm/entities/Player.java +++ b/src/main/java/com/drewm/entities/Player.java @@ -54,7 +54,7 @@ public Player(float worldX, float worldY, Playing playing, List bullets) this.hitboxHeight = Constants.PLAYER_SPRITE_HEIGHT * Constants.SCALE - 10; this.hitboxOffsetX = 5; this.hitboxOffsetY = 5; - this.showHitbox = true; + this.showHitbox = false; this.pistol = new Pistol(this, bullets); this.currentTimeLeft = maxTimeLimitSeconds; diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index 48a68fb..5cd880a 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -2,8 +2,8 @@ "players": [ { "type": "player", - "x": 2960.0, - "y": 1920.0, + "x": 1520.0, + "y": 960.0, "health": 10, "facingLeft": false } @@ -1474,16 +1474,16 @@ "endY": 2080, "width": 160, "height": 4, - "speed": 0.5 + "speed": 0.75 }, { "startX": 2080, - "startY": 2080, + "startY": 1760, "endX": 2080, "endY": 2960, "width": 160, "height": 4, - "speed": 0.5 + "speed": 0.75 } ] } From 81e269229f19b0dd7f174fe2e6f0904a1f6738d7 Mon Sep 17 00:00:00 2001 From: Drew Date: Sun, 15 Jun 2025 09:46:19 -0400 Subject: [PATCH 16/21] Hid sawblade and mine hitboxes. --- src/main/java/com/drewm/objects/FloatingMine.java | 2 +- src/main/java/com/drewm/objects/SawBlade.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/drewm/objects/FloatingMine.java b/src/main/java/com/drewm/objects/FloatingMine.java index e2d23ff..abe81dd 100644 --- a/src/main/java/com/drewm/objects/FloatingMine.java +++ b/src/main/java/com/drewm/objects/FloatingMine.java @@ -20,7 +20,7 @@ public class FloatingMine { private int spriteCounter = 0; private int spriteNum = 0; private float speed = 1f; - private final boolean showHitbox = true; + private final boolean showHitbox = false; public FloatingMine(float startX, float startY, float endX, float endY, Playing playing) { this.playing = playing; diff --git a/src/main/java/com/drewm/objects/SawBlade.java b/src/main/java/com/drewm/objects/SawBlade.java index f40530c..847adb0 100644 --- a/src/main/java/com/drewm/objects/SawBlade.java +++ b/src/main/java/com/drewm/objects/SawBlade.java @@ -24,7 +24,7 @@ public class SawBlade { private int spriteNum = 0; private float speed = 1f; private boolean upsideDown; - private boolean showHitbox = true; + private boolean showHitbox = false; public SawBlade(float startX, float endX, float y, boolean upsideDown, Playing playing) { this.playing = playing; From cebc7ad3687e35c68d3b964379ad8d6a51c47f02 Mon Sep 17 00:00:00 2001 From: Drew Date: Sun, 15 Jun 2025 10:43:56 -0400 Subject: [PATCH 17/21] Created FallingBlock class. Reads falling block data from level JSON. --- .../java/com/drewm/data/FallingBlockData.java | 9 +++ src/main/java/com/drewm/data/RoomData.java | 3 +- .../java/com/drewm/gamestates/Playing.java | 8 +++ .../java/com/drewm/levels/LevelManager.java | 9 ++- src/main/java/com/drewm/levels/Room.java | 7 ++- .../java/com/drewm/objects/FallingBlock.java | 62 +++++++++++++++++++ src/main/resources/maps/map1.json | 8 +++ 7 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/drewm/data/FallingBlockData.java create mode 100644 src/main/java/com/drewm/objects/FallingBlock.java diff --git a/src/main/java/com/drewm/data/FallingBlockData.java b/src/main/java/com/drewm/data/FallingBlockData.java new file mode 100644 index 0000000..69b6af5 --- /dev/null +++ b/src/main/java/com/drewm/data/FallingBlockData.java @@ -0,0 +1,9 @@ +package com.drewm.data; + +public record FallingBlockData( + float x, + float y, + float width, + float height +) { +} diff --git a/src/main/java/com/drewm/data/RoomData.java b/src/main/java/com/drewm/data/RoomData.java index 73438ae..d86560e 100644 --- a/src/main/java/com/drewm/data/RoomData.java +++ b/src/main/java/com/drewm/data/RoomData.java @@ -11,6 +11,7 @@ public record RoomData( List floatingMines, List sawBlades, List lasers, - List movingPlatforms + List movingPlatforms, + List fallingBlocks ) { } diff --git a/src/main/java/com/drewm/gamestates/Playing.java b/src/main/java/com/drewm/gamestates/Playing.java index 16f724e..90059d4 100644 --- a/src/main/java/com/drewm/gamestates/Playing.java +++ b/src/main/java/com/drewm/gamestates/Playing.java @@ -144,6 +144,10 @@ public void update() { movingPlatform.update(); } + for (FallingBlock fallingBlock : this.levelManager.getCurrentRoom().getFallingBlocks()) { + fallingBlock.update(); + } + Iterator explosionIterator = explosions.iterator(); while (explosionIterator.hasNext()) { Explosion explosion = explosionIterator.next(); @@ -197,6 +201,10 @@ public void draw(Graphics g) { movingPlatform.draw(g2); } + for (FallingBlock fallingBlock : this.levelManager.getCurrentRoom().getFallingBlocks()) { + fallingBlock.draw(g2); + } + Modal activeModal = getActiveModal(); if (activeModal != null) activeModal.draw(g); } diff --git a/src/main/java/com/drewm/levels/LevelManager.java b/src/main/java/com/drewm/levels/LevelManager.java index 0fefa2f..c910d5f 100644 --- a/src/main/java/com/drewm/levels/LevelManager.java +++ b/src/main/java/com/drewm/levels/LevelManager.java @@ -120,7 +120,14 @@ public void loadRooms(String filePath, boolean persistPlayerState) { movingPlatforms.add(new MovingPlatform(movingPlatform.startX(), movingPlatform.startY(), movingPlatform.endX(), movingPlatform.endY(), movingPlatform.width(), movingPlatform.height(), movingPlatform.speed(), playing)); } - rooms.put(i, new Room(worldMap, roomNumTileWidth, roomNumTileHeight, worldBackground, basicZombies, collectables, doors, floatingMines, sawBlades, lasers, movingPlatforms)); + // Load falling blocks + List fallingBlockData = room.fallingBlocks(); + List fallingBlocks = new ArrayList<>(); + for (FallingBlockData fallingBlock : fallingBlockData) { + fallingBlocks.add(new FallingBlock(fallingBlock.x(), fallingBlock.y(), fallingBlock.width(), fallingBlock.height(), playing)); + } + + rooms.put(i, new Room(worldMap, roomNumTileWidth, roomNumTileHeight, worldBackground, basicZombies, collectables, doors, floatingMines, sawBlades, lasers, movingPlatforms, fallingBlocks)); } } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/com/drewm/levels/Room.java b/src/main/java/com/drewm/levels/Room.java index 8108637..7d34b75 100644 --- a/src/main/java/com/drewm/levels/Room.java +++ b/src/main/java/com/drewm/levels/Room.java @@ -17,6 +17,7 @@ public class Room { private List sawBlades; private List lasers; private List movingPlatforms; + private List fallingBlocks; public Room(int[][] worldMap, int roomNumTileWidth, @@ -28,7 +29,8 @@ public Room(int[][] worldMap, List floatingMines, List sawBlades, List lasers, - List movingPlatforms + List movingPlatforms, + List fallingBlocks ) { this.worldMap = worldMap; this.worldBackground = worldBackground; @@ -42,6 +44,7 @@ public Room(int[][] worldMap, this.roomNumTileWidth = roomNumTileWidth; this.roomNumTileHeight = roomNumTileHeight; + this.fallingBlocks = fallingBlocks; } public int[][] getWorldMap() { @@ -105,4 +108,6 @@ public int getRoomNumTileHeight() { } public List getMovingPlatforms() { return movingPlatforms; } + + public List getFallingBlocks() { return fallingBlocks; } } diff --git a/src/main/java/com/drewm/objects/FallingBlock.java b/src/main/java/com/drewm/objects/FallingBlock.java new file mode 100644 index 0000000..b77d1a7 --- /dev/null +++ b/src/main/java/com/drewm/objects/FallingBlock.java @@ -0,0 +1,62 @@ +package com.drewm.objects; + +import com.drewm.gamestates.Playing; +import com.drewm.utils.Constants; + +import java.awt.*; +import java.awt.geom.Rectangle2D; + +public class FallingBlock { + private final Playing playing; + private float worldX, worldY; + private final float width, height; + + private final float midpoint; + private final float triggerRadius = 0.2f; + + public FallingBlock(float worldX, float worldY, float width, float height, Playing playing) { + this.playing = playing; + this.worldX = worldX; + this.worldY = worldY; + this.width = width; + this.height = height; + this.midpoint = worldX + width / 2; + } + + public void update() { + if (playing.player.worldX > midpoint - (midpoint - worldX) * triggerRadius && playing.player.worldX < midpoint + (midpoint - worldX) * triggerRadius) { + System.out.println("TRIGGER"); + } + } + + public void draw(Graphics2D g2) { + float screenX = this.worldX - playing.camera.getCameraX(); + float screenY = this.worldY - playing.camera.getCameraY(); + + if (screenX + width > 0 && + screenX < Constants.SCREEN_WIDTH && + screenY + height > 0 && + screenY < Constants.SCREEN_HEIGHT) { + + g2.setColor(Color.DARK_GRAY); + g2.fill(getScreenBounds()); + + g2.setColor(Color.LIGHT_GRAY); + g2.setStroke(new BasicStroke(4)); + Rectangle2D.Float bounds = getScreenBounds(); + g2.draw(new Rectangle2D.Float( + bounds.x + 4f / 2f, + bounds.y + 4f / 2f, + bounds.width - 4f, + bounds.height - 4f + )); + } + } + + + public Rectangle2D.Float getScreenBounds() { + float screenX = worldX - playing.camera.getCameraX(); + float screenY = worldY - playing.camera.getCameraY(); + return new Rectangle2D.Float(screenX, screenY, width, height); + } +} \ No newline at end of file diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index 5cd880a..84d7577 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -1485,6 +1485,14 @@ "height": 4, "speed": 0.75 } + ], + "fallingBlocks": [ + { + "x": 1840.0, + "y": 560.0, + "width": 640.0, + "height": 400.0 + } ] } ] From 77f0a6f2b8c6805d457d3ffc625c1cf2e06f81c8 Mon Sep 17 00:00:00 2001 From: Drew Date: Wed, 18 Jun 2025 14:57:15 -0400 Subject: [PATCH 18/21] Added vertical position check for FallingBlock trigger. --- src/main/java/com/drewm/objects/FallingBlock.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/drewm/objects/FallingBlock.java b/src/main/java/com/drewm/objects/FallingBlock.java index b77d1a7..82644a9 100644 --- a/src/main/java/com/drewm/objects/FallingBlock.java +++ b/src/main/java/com/drewm/objects/FallingBlock.java @@ -24,7 +24,10 @@ public FallingBlock(float worldX, float worldY, float width, float height, Playi } public void update() { - if (playing.player.worldX > midpoint - (midpoint - worldX) * triggerRadius && playing.player.worldX < midpoint + (midpoint - worldX) * triggerRadius) { + if (playing.player.worldX > midpoint - (midpoint - worldX) * triggerRadius && + playing.player.worldX < midpoint + (midpoint - worldX) * triggerRadius && + playing.player.worldY > worldY + height && playing.player.worldY < worldY + height + Constants.TILE_WIDTH * 3 + ) { System.out.println("TRIGGER"); } } From 138d3ef586f4b708cf03392c5298268588d2dfe6 Mon Sep 17 00:00:00 2001 From: Drew Date: Wed, 18 Jun 2025 15:22:14 -0400 Subject: [PATCH 19/21] Added entity collision with falling block. Falling block now kills you if struck by it. --- src/main/java/com/drewm/entities/Entity.java | 100 +++++++++++++++++- .../java/com/drewm/objects/FallingBlock.java | 72 ++++++++++++- 2 files changed, 167 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/drewm/entities/Entity.java b/src/main/java/com/drewm/entities/Entity.java index c1ee1f7..2bf0978 100644 --- a/src/main/java/com/drewm/entities/Entity.java +++ b/src/main/java/com/drewm/entities/Entity.java @@ -4,6 +4,7 @@ import com.drewm.levels.LevelManager; import com.drewm.main.Window; import com.drewm.objects.MovingPlatform; +import com.drewm.objects.FallingBlock; import com.drewm.utils.Constants; import java.awt.*; @@ -73,6 +74,8 @@ public void update(boolean jumpPressed) { updateGroundStatus(); + checkFallingBlockUndersideCollision(); + if (ridingPlatform != null && isOnGround) { worldX += ridingPlatform.getDeltaX(); worldY += ridingPlatform.getDeltaY(); @@ -107,10 +110,14 @@ private void updateGroundStatus() { playing.levelManager.isSolidTile(rightX, feetY + 2); MovingPlatform platformBelow = findPlatformBelow(); + FallingBlock fallingBlockBelow = findFallingBlockBelow(); if (platformBelow != null) { ridingPlatform = platformBelow; isOnGround = true; + } else if (fallingBlockBelow != null) { + ridingPlatform = null; + isOnGround = true; } else if (onSolidTile) { ridingPlatform = null; isOnGround = true; @@ -146,6 +153,24 @@ private MovingPlatform findPlatformBelow() { return null; } + private FallingBlock findFallingBlockBelow() { + Rectangle2D.Float entityBounds = getBounds(); + float entityBottom = entityBounds.y + entityBounds.height; + + for (FallingBlock fallingBlock : playing.levelManager.getCurrentRoom().getFallingBlocks()) { + Rectangle2D.Float blockBounds = fallingBlock.getBounds(); + float blockTop = blockBounds.y; + + if (Math.abs(entityBottom - blockTop) <= 3 && + entityBounds.x < blockBounds.x + blockBounds.width && + entityBounds.x + entityBounds.width > blockBounds.x) { + return fallingBlock; + } + } + + return null; + } + private void applyGravity() { if (!useGravity || isOnGround) return; @@ -179,6 +204,31 @@ private MovingPlatform checkOneWayPlatformCollision(float nextWorldY) { return null; } + private FallingBlock checkFallingBlockCollision(float nextWorldY) { + Rectangle2D.Float nextBounds = new Rectangle2D.Float( + worldX + hitboxOffsetX, + nextWorldY + hitboxOffsetY, + hitboxWidth, + hitboxHeight + ); + + if (velocityY > 0) { + for (FallingBlock fallingBlock : playing.levelManager.getCurrentRoom().getFallingBlocks()) { + Rectangle2D.Float blockBounds = fallingBlock.getBounds(); + + if (nextBounds.intersects(blockBounds) || + (nextBounds.y + nextBounds.height >= blockBounds.y && + nextBounds.y + nextBounds.height <= blockBounds.y + 5 && + nextBounds.x < blockBounds.x + blockBounds.width && + nextBounds.x + nextBounds.width > blockBounds.x)) { + return fallingBlock; + } + } + } + + return null; + } + private void moveVertically() { if (ridingPlatform != null && isOnGround) { return; @@ -188,12 +238,18 @@ private void moveVertically() { if (!isColliding((int) worldX, Math.round(nextWorldY))) { MovingPlatform platform = checkOneWayPlatformCollision(nextWorldY); + FallingBlock fallingBlock = checkFallingBlockCollision(nextWorldY); if (platform != null) { worldY = platform.getLandingY() - (hitboxOffsetY + hitboxHeight); velocityY = 0; isOnGround = true; ridingPlatform = platform; + } else if (fallingBlock != null) { + worldY = fallingBlock.getBounds().y - (hitboxOffsetY + hitboxHeight); + velocityY = 0; + isOnGround = true; + ridingPlatform = null; } else { worldY = nextWorldY; } @@ -203,6 +259,23 @@ private void moveVertically() { } } + public boolean isCollidingWithFallingBlocks(float testX, float testY) { + Rectangle2D.Float testBounds = new Rectangle2D.Float( + testX + hitboxOffsetX, + testY + hitboxOffsetY, + hitboxWidth, + hitboxHeight + ); + + for (FallingBlock fallingBlock : playing.levelManager.getCurrentRoom().getFallingBlocks()) { + if (testBounds.intersects(fallingBlock.getBounds())) { + return true; + } + } + + return false; + } + private void updateSpriteAnimation() { if (!isMoving) return; @@ -213,6 +286,27 @@ private void updateSpriteAnimation() { } } + private void checkFallingBlockUndersideCollision() { + Rectangle2D.Float entityBounds = getBounds(); + + for (FallingBlock fallingBlock : playing.levelManager.getCurrentRoom().getFallingBlocks()) { + if (fallingBlock.isFalling()) { + Rectangle2D.Float blockBounds = fallingBlock.getBounds(); + + if (entityBounds.intersects(blockBounds)) { + float entityTop = entityBounds.y; + float blockBottom = blockBounds.y + blockBounds.height; + + if (entityTop < blockBottom && entityTop + entityBounds.height > blockBounds.y) { + if (entityTop > blockBounds.y) { + takeDamage(this.health); + } + } + } + } + } + } + public Rectangle2D.Float getBounds() { return new Rectangle2D.Float(worldX + hitboxOffsetX, worldY + hitboxOffsetY, hitboxWidth, hitboxHeight); } @@ -229,8 +323,12 @@ public boolean isColliding(int worldX, int worldY) { int topY = worldY + hitboxOffsetY; int bottomY = worldY + hitboxOffsetY + hitboxHeight - 1; - return levelManager.isSolidTile(leftX, topY) || levelManager.isSolidTile(rightX, topY) || + boolean tileCollision = levelManager.isSolidTile(leftX, topY) || levelManager.isSolidTile(rightX, topY) || levelManager.isSolidTile(leftX, bottomY) || levelManager.isSolidTile(rightX, bottomY); + + boolean fallingBlockCollision = isCollidingWithFallingBlocks(worldX, worldY); + + return tileCollision || fallingBlockCollision; } public boolean isStandingOnSpike(int worldX, int worldY) { diff --git a/src/main/java/com/drewm/objects/FallingBlock.java b/src/main/java/com/drewm/objects/FallingBlock.java index 82644a9..5ca586c 100644 --- a/src/main/java/com/drewm/objects/FallingBlock.java +++ b/src/main/java/com/drewm/objects/FallingBlock.java @@ -14,6 +14,12 @@ public class FallingBlock { private final float midpoint; private final float triggerRadius = 0.2f; + private boolean isTriggered = false; + private boolean isFalling = false; + private float fallVelocity = 0; + private final float gravity = Constants.GRAVITY_DESCEND; + private final float maxFallSpeed = Constants.TERMINAL_VELOCITY; + public FallingBlock(float worldX, float worldY, float width, float height, Playing playing) { this.playing = playing; this.worldX = worldX; @@ -24,11 +30,30 @@ public FallingBlock(float worldX, float worldY, float width, float height, Playi } public void update() { - if (playing.player.worldX > midpoint - (midpoint - worldX) * triggerRadius && + if (!isTriggered && + playing.player.worldX > midpoint - (midpoint - worldX) * triggerRadius && playing.player.worldX < midpoint + (midpoint - worldX) * triggerRadius && - playing.player.worldY > worldY + height && playing.player.worldY < worldY + height + Constants.TILE_WIDTH * 3 - ) { - System.out.println("TRIGGER"); + playing.player.worldY > worldY + height && + playing.player.worldY < worldY + height + Constants.TILE_WIDTH * 3) { + + isTriggered = true; + isFalling = true; + } + + if (isFalling) { + fallVelocity += gravity; + if (fallVelocity > maxFallSpeed) { + fallVelocity = maxFallSpeed; + } + + float nextY = worldY + fallVelocity; + + if (!isColliding(worldX, nextY)) { + worldY = nextY; + } else { + isFalling = false; + fallVelocity = 0; + } } } @@ -56,10 +81,49 @@ public void draw(Graphics2D g2) { } } + private boolean isColliding(float testX, float testY) { + int leftX = (int) testX; + int rightX = (int) (testX + width - 1); + int topY = (int) testY; + int bottomY = (int) (testY + height - 1); + + return playing.levelManager.isSolidTile(leftX, topY) || + playing.levelManager.isSolidTile(rightX, topY) || + playing.levelManager.isSolidTile(leftX, bottomY) || + playing.levelManager.isSolidTile(rightX, bottomY); + } + + public Rectangle2D.Float getBounds() { + return new Rectangle2D.Float(worldX, worldY, width, height); + } public Rectangle2D.Float getScreenBounds() { float screenX = worldX - playing.camera.getCameraX(); float screenY = worldY - playing.camera.getCameraY(); return new Rectangle2D.Float(screenX, screenY, width, height); } + + public float getWorldX() { + return worldX; + } + + public float getWorldY() { + return worldY; + } + + public float getWidth() { + return width; + } + + public float getHeight() { + return height; + } + + public boolean isTriggered() { + return isTriggered; + } + + public boolean isFalling() { + return isFalling; + } } \ No newline at end of file From c05bb5c9666d53f877f04a7262bb4433b4ae04d5 Mon Sep 17 00:00:00 2001 From: Drew Date: Wed, 18 Jun 2025 15:28:49 -0400 Subject: [PATCH 20/21] Fixed bug with entity collision with side of block. --- src/main/java/com/drewm/entities/Entity.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/drewm/entities/Entity.java b/src/main/java/com/drewm/entities/Entity.java index 2bf0978..d7e0412 100644 --- a/src/main/java/com/drewm/entities/Entity.java +++ b/src/main/java/com/drewm/entities/Entity.java @@ -216,11 +216,11 @@ private FallingBlock checkFallingBlockCollision(float nextWorldY) { for (FallingBlock fallingBlock : playing.levelManager.getCurrentRoom().getFallingBlocks()) { Rectangle2D.Float blockBounds = fallingBlock.getBounds(); - if (nextBounds.intersects(blockBounds) || - (nextBounds.y + nextBounds.height >= blockBounds.y && - nextBounds.y + nextBounds.height <= blockBounds.y + 5 && - nextBounds.x < blockBounds.x + blockBounds.width && - nextBounds.x + nextBounds.width > blockBounds.x)) { + if (nextBounds.y + nextBounds.height >= blockBounds.y && + nextBounds.y + nextBounds.height <= blockBounds.y + 5 && + nextBounds.x < blockBounds.x + blockBounds.width && + nextBounds.x + nextBounds.width > blockBounds.x && + previousWorldY + hitboxOffsetY + hitboxHeight <= blockBounds.y + 3) { return fallingBlock; } } From bf9d9ac7202c08d7271ad0726025b851685d587a Mon Sep 17 00:00:00 2001 From: Drew Date: Wed, 18 Jun 2025 15:42:17 -0400 Subject: [PATCH 21/21] Shrunk size of block. Made it slower so player can more easily survive it. --- src/main/java/com/drewm/objects/FallingBlock.java | 4 ++-- src/main/resources/maps/map1.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/drewm/objects/FallingBlock.java b/src/main/java/com/drewm/objects/FallingBlock.java index 5ca586c..55f5ade 100644 --- a/src/main/java/com/drewm/objects/FallingBlock.java +++ b/src/main/java/com/drewm/objects/FallingBlock.java @@ -18,7 +18,7 @@ public class FallingBlock { private boolean isFalling = false; private float fallVelocity = 0; private final float gravity = Constants.GRAVITY_DESCEND; - private final float maxFallSpeed = Constants.TERMINAL_VELOCITY; + private final float maxFallSpeed = 1; public FallingBlock(float worldX, float worldY, float width, float height, Playing playing) { this.playing = playing; @@ -34,7 +34,7 @@ public void update() { playing.player.worldX > midpoint - (midpoint - worldX) * triggerRadius && playing.player.worldX < midpoint + (midpoint - worldX) * triggerRadius && playing.player.worldY > worldY + height && - playing.player.worldY < worldY + height + Constants.TILE_WIDTH * 3) { + playing.player.worldY < worldY + height + Constants.TILE_SIZE * 3) { isTriggered = true; isFalling = true; diff --git a/src/main/resources/maps/map1.json b/src/main/resources/maps/map1.json index 84d7577..963f53f 100644 --- a/src/main/resources/maps/map1.json +++ b/src/main/resources/maps/map1.json @@ -25,7 +25,7 @@ [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,9,9], [9,9,9,11,12,12,13,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,20,20,20,20,2,12,12,12,12,12,12,13,9,9], [9,9,9,11,12,12,13,9,19,20,20,2,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,14,8,9,9,9,9,10,12,12,12,12,12,12,13,9,9], - [9,9,9,11,12,12,13,9,9,9,9,19,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,20,20,20,2,12,12,12,12,0,20,20,20,21,9,9,9,9,19,1,2,12,12,12,12,13,9,9], + [9,9,9,11,12,12,13,9,9,9,9,19,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,1,20,20,20,2,12,12,12,12,0,20,20,20,21,9,9,9,9,19,1,2,12,12,12,12,13,9,9], [9,9,9,11,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,14,14,14,14,8,9,9,9,9,9,9,9,9,3,17,18,12,12,12,12,13,9,9], [9,9,9,11,12,12,13,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,12,12,12,12,12,12,13,9,9], [9,9,9,11,12,12,13,9,3,4,4,4,4,4,4,7,4,4,7,4,4,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,9,9,9,9,10,12,12,12,12,12,12,13,9,9], @@ -1488,10 +1488,10 @@ ], "fallingBlocks": [ { - "x": 1840.0, + "x": 1920.0, "y": 560.0, - "width": 640.0, - "height": 400.0 + "width": 480.0, + "height": 320.0 } ] }