corrected the jumps so they would rise correctly, as well as an issue with the position update in match.

This commit is contained in:
Azra Victor 2021-06-16 00:38:59 +02:00 committed by no
parent c3430a9f3f
commit ddaf700b55
2 changed files with 31 additions and 13 deletions

View File

@ -71,7 +71,7 @@ public class BlueBaseFrames {
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
phb.add(bStandPHB1);
pthb.add(bStandPTHB1);
Frame blueStandframe1 = new Frame(-10.0,0.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
Frame blueStandframe1 = new Frame(18.0,0.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
bStandPB1,false,false,false,false,false);
blueStandframe1.setSpriteWrap(816,0,102,120);
return blueStandframe1;
@ -85,7 +85,7 @@ public class BlueBaseFrames {
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
phb.add(bStandPHB1);
pthb.add(bStandPTHB1);
Frame blueStandframe1 = new Frame(10.0,0.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
Frame blueStandframe1 = new Frame(-18.0,0.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
bStandPB1,false,false,false,false,false);
blueStandframe1.setSpriteWrap(816,0,102,120);
return blueStandframe1;
@ -110,7 +110,7 @@ public class BlueBaseFrames {
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
phb.add(bStandPHB1);
pthb.add(bStandPTHB1);
Frame blueStandframe1 = new Frame(-10.0,10.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
Frame blueStandframe1 = new Frame(18.0,10.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
bStandPB1,false,false,false,false,false);
blueStandframe1.setSpriteWrap(816,0,102,120);
return blueStandframe1;
@ -124,7 +124,7 @@ public class BlueBaseFrames {
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
phb.add(bStandPHB1);
pthb.add(bStandPTHB1);
Frame blueStandframe1 = new Frame(10.0,10.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
Frame blueStandframe1 = new Frame(-18.0,10.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
bStandPB1,false,false,false,false,false);
blueStandframe1.setSpriteWrap(816,0,102,120);
return blueStandframe1;
@ -149,7 +149,7 @@ public class BlueBaseFrames {
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
phb.add(bStandPHB1);
pthb.add(bStandPTHB1);
Frame blueStandframe1 = new Frame(-10.0,-10.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
Frame blueStandframe1 = new Frame(18.0,-10.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
bStandPB1,false,false,false,false,false);
blueStandframe1.setSpriteWrap(816,0,102,120);
return blueStandframe1;
@ -174,7 +174,7 @@ public class BlueBaseFrames {
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
phb.add(bStandPHB1);
pthb.add(bStandPTHB1);
Frame blueStandframe1 = new Frame(10.0,-10.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
Frame blueStandframe1 = new Frame(-18.0,-10.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
bStandPB1,false,false,false,false,false);
blueStandframe1.setSpriteWrap(816,0,102,120);
return blueStandframe1;

View File

@ -224,23 +224,40 @@ public class match {
}
nextFrame(p1,inputsP1);
nextFrame(p2,inputsP2);
updatePos(p1);
updatePos(p2);
f = p1.getCurrentframe();
objP1.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]);
objP1.translate(new Vector3f(p1.getPosX()-oldPosXp1,p1.getPosY()-oldPosYp1,0));
updatePos(p1,p1.getPosX()< p2.getPosX());
updatePos(p2,!(p1.getPosX()< p2.getPosX()));
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));
boolean p1LooksRight = p1.getPosX() < p2.getPosX();
if(p1LooksRight) {
f = p1.getCurrentframe();
objP1.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]);
objP1.translate(new Vector3f(p1.getPosX()-oldPosXp1,p1.getPosY()-oldPosYp1,0));
f = p2.getCurrentframe();
objP2.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]);
objP2.translate(new Vector3f(0-(p2.getPosX()-oldPosXp2),p2.getPosY()-oldPosYp2,0));
Frame nf = new Frame();
nf.clone(p2.getCurrentframe());
nf.invertHitBoxes();
p2.setCurrentFrame(nf);
objP2.flipTextureWrapH();
} else {
Frame p1f = p1.getCurrentframe();
objP1.setTextureWrap(p1f.getSprite()[0], p1f.getSprite()[1], p1f.getSprite()[2], p1f.getSprite()[3]);
objP1.translate(new Vector3f(p1.getPosX()-oldPosXp1,p1.getPosY()-oldPosYp1,0));
Frame p2f = p2.getCurrentframe();
objP2.setTextureWrap(p2f.getSprite()[0], p2f.getSprite()[1], p2f.getSprite()[2], p2f.getSprite()[3]);
objP2.translate(new Vector3f(p2.getPosX()-oldPosXp2,p2.getPosY()-oldPosYp2,0));
Frame nf = new Frame();
nf.clone(p1.getCurrentframe());
nf.invertHitBoxes();
@ -497,8 +514,9 @@ public class match {
}
}
private static void updatePos(Character c) {
c.setPos((int)(c.getPosX()+c.getCurrentframe().getMove_x()),(int)(c.getPosY()+c.getCurrentframe().getMove_y()));
private static void updatePos(Character c, boolean looksRight) {
if(looksRight) {c.setPos((int)(c.getPosX()+c.getCurrentframe().getMove_x()),(int)(c.getPosY()+c.getCurrentframe().getMove_y()));}
else {c.setPos((int)(c.getPosX()-c.getCurrentframe().getMove_x()),(int)(c.getPosY()+c.getCurrentframe().getMove_y()));}
}
}