pushbox now showing in addHitbox

This commit is contained in:
Antoine 2021-06-20 00:48:50 +02:00
parent ec37cab5ef
commit 3e3e3511e8

View File

@ -324,7 +324,6 @@ public class match {
updatePos(p1,p1LooksRight);
updatePos(p2,!p1LooksRight);
if(p1LooksRight) {
f = p1.getCurrentframe();
@ -333,7 +332,7 @@ public class match {
f = p2.getCurrentframe();
objP2.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]);
objP2.translate(new Vector3f(-(p2.getPosX() - oldPosXp2),p2.getPosY()-oldPosYp2,0));
objP2.translate(new Vector3f(p2.getPosX() - oldPosXp2,p2.getPosY()-oldPosYp2,0));
Frame nf = new Frame();
nf.clone(p2.getCurrentframe());
@ -341,7 +340,6 @@ public class match {
p2.setCurrentFrame(nf);
objP2.flipTextureWrapH();
} else {
Frame p1f = p1.getCurrentframe();
@ -634,7 +632,11 @@ public class match {
else {c.setPos((int)(c.getPosX()-c.getCurrentframe().getMove_x()),(int)(c.getPosY()+c.getCurrentframe().getMove_y()));}
}
// TODO giga memory leak ?
/*
HITBOX DEBUG METHOD
*/
private static void addHitboxEngine(){
for (ObjectGl obj : listHitboxObj){
engine.add_objectGl(obj);
@ -655,25 +657,38 @@ public class match {
Vector3f green = new Vector3f(33f/255f, 135f/255f, 12f/255f);
Vector3f red = new Vector3f(120f/255f, 19f/255f, 12f/255f);
Vector3f lightBlue = new Vector3f(32f/255f, 103f/255f, 201f/255f);
Vector3f purple = new Vector3f(116f/255f, 52f/255f, 235f/255f);
float offset = 0;
Push_HitBox pushHitBox = f.getPushHitBox();
if (pushHitBox != null){
Hitbox hb = new Hitbox(100f + offset, pushHitBox.getSize_x(), pushHitBox.getSize_y(), 1f, purple);
hb.translate(new Vector3f(pushHitBox.getPosX() + posC.x, pushHitBox.getPosY() + posC.y));
listHitboxObj.add(hb);
offset+=0.1f;
}
for (Passive_HitBox passive_hitBox : f.getPassHitBox()){
Hitbox hb = new Hitbox(100f, passive_hitBox.getSize_x(), passive_hitBox.getSize_y(), 1f, darkBlue);
Hitbox hb = new Hitbox(100f + offset, passive_hitBox.getSize_x(), passive_hitBox.getSize_y(), 1f, darkBlue);
hb.translate(new Vector3f(passive_hitBox.getPosX() + posC.x, passive_hitBox.getPosY() + posC.y));
listHitboxObj.add(hb);
offset+=0.1f;
}
for (Passive_throw_HitBox passive_throw_hitBox : f.getPassThrowHitBox()){
Hitbox hb = new Hitbox(101f, passive_throw_hitBox.getSize_x(), passive_throw_hitBox.getSize_y(), 1f, green);
Hitbox hb = new Hitbox(100f + offset, passive_throw_hitBox.getSize_x(), passive_throw_hitBox.getSize_y(), 1f, green);
hb.translate(new Vector3f(passive_throw_hitBox.getPosX() + posC.x, passive_throw_hitBox.getPosY() + posC.y));
listHitboxObj.add(hb);
offset+=0.1f;
}
for (Active_HitBox active_hitBox : f.getActHitBox()){
Hitbox hb = new Hitbox(102f, active_hitBox.getSize_x(), active_hitBox.getSize_y(), 1f, red);
Hitbox hb = new Hitbox(100f + offset, active_hitBox.getSize_x(), active_hitBox.getSize_y(), 1f, red);
hb.translate(new Vector3f(active_hitBox.getPosX() + posC.x, active_hitBox.getPosY() + posC.y));
listHitboxObj.add(hb);
offset+=0.1f;
}
for (Active_throw_Hitbox active_throw_hitbox : f.getActThrowHitBox()){
Hitbox hb = new Hitbox(103f, active_throw_hitbox.getSize_x(), active_throw_hitbox.getSize_y(), 1f, lightBlue);
Hitbox hb = new Hitbox(100f + offset, active_throw_hitbox.getSize_x(), active_throw_hitbox.getSize_y(), 1f, lightBlue);
hb.translate(new Vector3f(active_throw_hitbox.getPosX() + posC.x, active_throw_hitbox.getPosY() + posC.y));
listHitboxObj.add(hb);
offset+=1;
}
}