Save actual Rectengle Hitbox Data

This commit is contained in:
2026-04-09 17:29:59 +03:00
parent f43795e1f4
commit 55aab3cac0
2 changed files with 10 additions and 6 deletions

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><objecttypes> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<objecttypes>
<objecttype color="#a0a0a4" name="misato"> <objecttype color="#a0a0a4" name="misato">
<property default="Solid" name="class" type="string"/> <property default="Solid" name="class" type="string"/>
<property default="1 1 201 0 184 189 72 191 " name="drawbox" type="string"/> <property default="1 1 201 0 184 189 72 191 " name="drawbox" type="string"/>
<property default="Rectangle -16 8 52 42" name="hitbox" type="string"/>
<property default="Rectangle 0 0 48 69" name="hitbox" type="string"/></objecttype> </objecttype>
<objecttype color="#a0a0a4" name="starlight"> <objecttype color="#a0a0a4" name="starlight">
<property default="Solid" name="class" type="string"/> <property default="Solid" name="class" type="string"/>
<property default="4 3 162 9 129 121 53 140 " name="drawbox" type="string"/> <property default="4 3 162 9 129 121 53 140 " name="drawbox" type="string"/>

View File

@ -108,7 +108,10 @@ public class HitboxRectangle extends Hitbox {
bottomPoint.y=currentPoint.y; bottomPoint.y=currentPoint.y;
} }
} }
referencePoint.x = bottomPoint.x-owner.getImage().getWidth()/2; bottomPoint = isometricToCartesian(bottomPoint.x,bottomPoint.y,bottomPoint);
referencePoint.y = bottomPoint.y-owner.getImage().getHeight(); Point cartesianCenterImagePoint= new Point(0,0);
cartesianCenterImagePoint = isometricToCartesian(owner.getImage().getWidth()/2,owner.getImage().getHeight(),cartesianCenterImagePoint);
referencePoint.x = cartesianCenterImagePoint.x-bottomPoint.x;
referencePoint.y = cartesianCenterImagePoint.y-bottomPoint.y;
} }
} }