Parsing data for drawing Rectangle Hitbox

This commit is contained in:
2026-04-09 17:55:17 +03:00
parent 55aab3cac0
commit 54dbfbabf4
2 changed files with 13 additions and 8 deletions

View File

@ -71,13 +71,18 @@ public class HitboxRectangle extends Hitbox {
}
//+++++++
private void createCartesianPointsFromWidthAndHeigh(){
Point refIsoPoint = new Point(owner.getWidth()/2+referencePoint.x,owner.getHeight()+referencePoint.y);
Point refCartesianPoint = isometricToCartesian(refIsoPoint.x,refIsoPoint.y,new Point(0,0));
Point cartesianCenterImagePoint = new Point(0, 0);
isometricToCartesian(owner.getImage().getWidth()/2,owner.getImage().getHeight(),cartesianCenterImagePoint);
Point cartesianCenterRefPoint = new Point(cartesianCenterImagePoint.x-referencePoint.x, cartesianCenterImagePoint.y-referencePoint.y);
listPointsCartesian.clear();
listPointsCartesian.add(new Point(refCartesianPoint.x-widthHitbox,refCartesianPoint.y));
listPointsCartesian.add(new Point(refCartesianPoint.x,refCartesianPoint.y));
listPointsCartesian.add(new Point(refCartesianPoint.x,refCartesianPoint.y-heightHitbox));
listPointsCartesian.add(new Point(refCartesianPoint.x-widthHitbox,refCartesianPoint.y-heightHitbox));
listPointsCartesian.add(new Point(cartesianCenterRefPoint.x-widthHitbox,cartesianCenterRefPoint.y));
listPointsCartesian.add(new Point(cartesianCenterRefPoint.x,cartesianCenterRefPoint.y));
listPointsCartesian.add(new Point(cartesianCenterRefPoint.x,cartesianCenterRefPoint.y-heightHitbox));
listPointsCartesian.add(new Point(cartesianCenterRefPoint.x-widthHitbox,cartesianCenterRefPoint.y-heightHitbox));
}
public List<Point> getListPointsIso() {