From ddaf700b552bed5e2aee11dd987afb3643a8d978 Mon Sep 17 00:00:00 2001 From: Azra Victor Date: Wed, 16 Jun 2021 00:38:59 +0200 Subject: [PATCH] corrected the jumps so they would rise correctly, as well as an issue with the position update in match. --- .../Characters/Blue/BlueBaseFrames.java | 12 +++---- src/gameplay/match/match.java | 32 +++++++++++++++---- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/gameplay/Characters/Blue/BlueBaseFrames.java b/src/gameplay/Characters/Blue/BlueBaseFrames.java index a5e121c..d7ff88e 100644 --- a/src/gameplay/Characters/Blue/BlueBaseFrames.java +++ b/src/gameplay/Characters/Blue/BlueBaseFrames.java @@ -71,7 +71,7 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(-10.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), + Frame blueStandframe1 = new Frame(18.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), bStandPB1,false,false,false,false,false); blueStandframe1.setSpriteWrap(816,0,102,120); return blueStandframe1; @@ -85,7 +85,7 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(10.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), + Frame blueStandframe1 = new Frame(-18.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), bStandPB1,false,false,false,false,false); blueStandframe1.setSpriteWrap(816,0,102,120); return blueStandframe1; @@ -110,7 +110,7 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(-10.0,10.0,phb,new ArrayList(),pthb,new ArrayList(), + Frame blueStandframe1 = new Frame(18.0,10.0,phb,new ArrayList(),pthb,new ArrayList(), bStandPB1,false,false,false,false,false); blueStandframe1.setSpriteWrap(816,0,102,120); return blueStandframe1; @@ -124,7 +124,7 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(10.0,10.0,phb,new ArrayList(),pthb,new ArrayList(), + Frame blueStandframe1 = new Frame(-18.0,10.0,phb,new ArrayList(),pthb,new ArrayList(), bStandPB1,false,false,false,false,false); blueStandframe1.setSpriteWrap(816,0,102,120); return blueStandframe1; @@ -149,7 +149,7 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(-10.0,-10.0,phb,new ArrayList(),pthb,new ArrayList(), + Frame blueStandframe1 = new Frame(18.0,-10.0,phb,new ArrayList(),pthb,new ArrayList(), bStandPB1,false,false,false,false,false); blueStandframe1.setSpriteWrap(816,0,102,120); return blueStandframe1; @@ -174,7 +174,7 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(10.0,-10.0,phb,new ArrayList(),pthb,new ArrayList(), + Frame blueStandframe1 = new Frame(-18.0,-10.0,phb,new ArrayList(),pthb,new ArrayList(), bStandPB1,false,false,false,false,false); blueStandframe1.setSpriteWrap(816,0,102,120); return blueStandframe1; diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index d2f1b10..9716032 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -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()));} } }