From 7a1700cec3afdce714468813d68c94fb1e0d47e0 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 18 Oct 2023 20:17:26 -0500 Subject: [PATCH] finalized --- src/engine/objects/AbstractCharacter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index a2abf80a..eddf8ba6 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -989,11 +989,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject { Building building = BuildingManager.getBuildingAtLocation(this.loc); Regions region = null; - if(building != null){ + if(building != null) { //look for region in the building we are in - for(Regions regionCycle : building.getBounds().getRegions()) - if(regionCycle.isPointInPolygon(value) && Math.abs(regionCycle.highLerp.y - value.y) < 10) + for (Regions regionCycle : building.getBounds().getRegions()) { + float regionHeight = regionCycle.highLerp.y - regionCycle.lowLerp.y; + if (regionCycle.isPointInPolygon(value) && Math.abs(regionCycle.highLerp.y - value.y) < regionHeight) region = regionCycle; + } } float regionHeightOffset = 0; if(region != null){