Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
acc0b66
FloatingMine now uses Elliptical hitbox.
drew18moore Jun 2, 2025
3229cfb
SawBlade now uses semi-circle hitbox.
drew18moore Jun 2, 2025
85174a3
Merge pull request #12 from drew18moore/updated-sawblade-mine-hitboxes
drew18moore Jun 2, 2025
73edd38
New small sawblade sprite. Made existing sawblades smaller.
drew18moore Jun 2, 2025
78655f2
Removed old maps. Renamed main map.
drew18moore Jun 2, 2025
63143ea
Created shell of a MovingPlatform class.
drew18moore Jun 2, 2025
d14c3d5
Created data records for moving platforms added moving platforms list…
drew18moore Jun 2, 2025
319de6b
LevelManager now reads movingPlatforms from JSON into game state. Set…
drew18moore Jun 2, 2025
649f879
Cleaned up Entity update() code.
drew18moore Jun 6, 2025
572c866
Implemented MovingPlatform collision (no movement yet). Renamed objec…
drew18moore Jun 8, 2025
e0ced46
Changed data structure for moving platforms in level json.
drew18moore Jun 9, 2025
c9844f4
Platforms now move.
drew18moore Jun 9, 2025
0f5aacf
Player now moves with the platform.
drew18moore Jun 14, 2025
60a691a
Simplified some of the logic.
drew18moore Jun 14, 2025
5184604
Wider platforms. Platforms now have color.
drew18moore Jun 14, 2025
e136de7
Hid player hitbox. Moved player starting point. Increased speed of pl…
drew18moore Jun 14, 2025
81e2692
Hid sawblade and mine hitboxes.
drew18moore Jun 15, 2025
9f0a260
Merge pull request #13 from drew18moore/moving-platforms
drew18moore Jun 15, 2025
cebc7ad
Created FallingBlock class. Reads falling block data from level JSON.
drew18moore Jun 15, 2025
77f0a6f
Added vertical position check for FallingBlock trigger.
drew18moore Jun 18, 2025
138d3ef
Added entity collision with falling block. Falling block now kills yo…
drew18moore Jun 18, 2025
c05bb5c
Fixed bug with entity collision with side of block.
drew18moore Jun 18, 2025
bf9d9ac
Shrunk size of block. Made it slower so player can more easily surviv…
drew18moore Jun 18, 2025
3853589
Merge pull request #14 from drew18moore/falling-block
drew18moore Jun 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/com/drewm/data/FallingBlockData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.drewm.data;

public record FallingBlockData(
float x,
float y,
float width,
float height
) {
}
12 changes: 12 additions & 0 deletions src/main/java/com/drewm/data/MovingPlatformData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.drewm.data;

public record MovingPlatformData(
float startX,
float startY,
float endX,
float endY,
float width,
float height,
float speed
) {
}
4 changes: 3 additions & 1 deletion src/main/java/com/drewm/data/RoomData.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public record RoomData(
List<DoorData> doors,
List<FloatingMineData> floatingMines,
List<SawBladeData> sawBlades,
List<LaserData> lasers
List<LaserData> lasers,
List<MovingPlatformData> movingPlatforms,
List<FallingBlockData> fallingBlocks
) {
}
14 changes: 2 additions & 12 deletions src/main/java/com/drewm/entities/BasicZombie.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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();

Expand Down
Loading
Loading