Parsing data for drawing Rectangle Hitbox
This commit is contained in:
@ -3,12 +3,12 @@
|
|||||||
<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 -11 10 49 67" 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"/>
|
||||||
<property default="Circle 15 4 31" name="hitbox" type="string"/>
|
<property default="Rectangle 18 -2 34 108" name="hitbox" type="string"/>
|
||||||
</objecttype>
|
</objecttype>
|
||||||
<objecttype color="#a0a0a4" name="tavern">
|
<objecttype color="#a0a0a4" name="tavern">
|
||||||
<property default="Solid" name="class" type="string"/>
|
<property default="Solid" name="class" type="string"/>
|
||||||
|
|||||||
@ -71,13 +71,18 @@ public class HitboxRectangle extends Hitbox {
|
|||||||
}
|
}
|
||||||
//+++++++
|
//+++++++
|
||||||
private void createCartesianPointsFromWidthAndHeigh(){
|
private void createCartesianPointsFromWidthAndHeigh(){
|
||||||
Point refIsoPoint = new Point(owner.getWidth()/2+referencePoint.x,owner.getHeight()+referencePoint.y);
|
Point cartesianCenterImagePoint = new Point(0, 0);
|
||||||
Point refCartesianPoint = isometricToCartesian(refIsoPoint.x,refIsoPoint.y,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.clear();
|
||||||
listPointsCartesian.add(new Point(refCartesianPoint.x-widthHitbox,refCartesianPoint.y));
|
listPointsCartesian.add(new Point(cartesianCenterRefPoint.x-widthHitbox,cartesianCenterRefPoint.y));
|
||||||
listPointsCartesian.add(new Point(refCartesianPoint.x,refCartesianPoint.y));
|
listPointsCartesian.add(new Point(cartesianCenterRefPoint.x,cartesianCenterRefPoint.y));
|
||||||
listPointsCartesian.add(new Point(refCartesianPoint.x,refCartesianPoint.y-heightHitbox));
|
listPointsCartesian.add(new Point(cartesianCenterRefPoint.x,cartesianCenterRefPoint.y-heightHitbox));
|
||||||
listPointsCartesian.add(new Point(refCartesianPoint.x-widthHitbox,refCartesianPoint.y-heightHitbox));
|
listPointsCartesian.add(new Point(cartesianCenterRefPoint.x-widthHitbox,cartesianCenterRefPoint.y-heightHitbox));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Point> getListPointsIso() {
|
public List<Point> getListPointsIso() {
|
||||||
|
|||||||
Reference in New Issue
Block a user