handleHits && handleThrows now take into account the y position of the entity

This commit is contained in:
Antoine 2021-06-24 02:54:22 +02:00
parent a67cee242b
commit 1c208d9792

View File

@ -584,7 +584,7 @@ public class match {
|| (!p1LooksRight && (atH.getPosX()+p1.getPosX()+ atH.getSize_x() < ptH.getPosX()+p2.getPosX()+ptH.getSize_x())
&& (atH.getPosX() > ptH.getPosX()));
boolean touchV = (atH.getPosY() - atH.getSize_y() < ptH.getPosY()) && (atH.getPosY() > ptH.getPosY() - ptH.getSize_y());
boolean touchV = (p1.getPosY() - atH.getPosY() - atH.getSize_y() < p2.getPosY() - ptH.getPosY()) && (p1.getPosY() - atH.getPosY() > p2.getPosY() - ptH.getPosY() - ptH.getSize_y());
if(touchH && touchV) {
hit.setHasHit(true);
tP.set(0,hit);
@ -616,7 +616,7 @@ public class match {
|| (!p1LooksRight && (aH.getPosX()+p1.getPosX()+ aH.getSize_x() < pH.getPosX()+p2.getPosX()+pH.getSize_x())
&& (aH.getPosX() > pH.getPosX()));
boolean touchV = (aH.getPosY() - aH.getSize_y() < pH.getPosY()) && (aH.getPosY() > pH.getPosY() - pH.getSize_y());
boolean touchV = (p1.getPosY() - aH.getPosY() - aH.getSize_y() < p2.getPosY() - pH.getPosY()) && (p1.getPosY() - aH.getPosY() > p2.getPosY() - pH.getPosY() - pH.getSize_y());
if(touchH && touchV) {
getHit(p2,hit,inputsP2.getLatestInputs());
hit.setHasHit(true);