From 8a89007304d8d146f747c6727eabe9d8ec4093e4 Mon Sep 17 00:00:00 2001 From: Azra Victor Date: Wed, 23 Jun 2021 12:00:47 +0200 Subject: [PATCH 01/10] completed attackpart.clone() which was missing some elements --- src/gameplay/actions/attackPart.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gameplay/actions/attackPart.java b/src/gameplay/actions/attackPart.java index c08d1c5..6c2d91c 100644 --- a/src/gameplay/actions/attackPart.java +++ b/src/gameplay/actions/attackPart.java @@ -138,6 +138,10 @@ public class attackPart { this.knockbackOnHit = aP.getKnockbackOnHit(); this.knockbackOnBlock = aP.getKnockbackOnBlock(); this.damage = aP.getDamage(); + this.isLow = aP.isLow(); + this.isOverHead = aP.isOverHead(); + this.knocksDown = aP.knocksDown(); + if(this.frames.length >= 1) {this.frames[this.frames.length -1].setLastFrameOfHit(true);} } public boolean isHasHit() { From 5145e3cef04ddf0c5026c345951c5a63c01de694 Mon Sep 17 00:00:00 2001 From: no Date: Wed, 23 Jun 2021 12:32:49 +0200 Subject: [PATCH 02/10] added stand D hitboxes --- .../Characters/Blue/BlueBaseFrames.java | 2 +- src/gameplay/Characters/Blue/BlueNormals.java | 152 +++++++++++------- 2 files changed, 94 insertions(+), 60 deletions(-) diff --git a/src/gameplay/Characters/Blue/BlueBaseFrames.java b/src/gameplay/Characters/Blue/BlueBaseFrames.java index f0476a7..40f0ddb 100644 --- a/src/gameplay/Characters/Blue/BlueBaseFrames.java +++ b/src/gameplay/Characters/Blue/BlueBaseFrames.java @@ -761,7 +761,7 @@ public class BlueBaseFrames { String path = "textures/Sprite_sans_grille_9comp.png"; String pathToBG = "textures/arena1.png"; - Frame f = BlueMisc.blueCrouchGuard(); + Frame f = BlueNormals.ForwardDFrame0(); ObjectGl blue = new ObjectGl(0f, 138f, 138f, 5f, path, null); diff --git a/src/gameplay/Characters/Blue/BlueNormals.java b/src/gameplay/Characters/Blue/BlueNormals.java index def4b96..c174351 100644 --- a/src/gameplay/Characters/Blue/BlueNormals.java +++ b/src/gameplay/Characters/Blue/BlueNormals.java @@ -17,7 +17,7 @@ import static gameplay.input.ButtonIG.*; public class BlueNormals { - private static Frame crouchAFrame1(){ + protected static Frame crouchAFrame1(){ //movement data double moveX = 0.0; double moveY = 0.0; @@ -50,7 +50,7 @@ public class BlueNormals { return f; } - private static Frame crouchAFrame2(){ + protected static Frame crouchAFrame2(){ //movement data double moveX = 0.0; double moveY = 0.0; @@ -87,7 +87,7 @@ public class BlueNormals { return f; } - private static Frame crouchAFrame3(){ + protected static Frame crouchAFrame3(){ //movement data double moveX = 0.0; double moveY = 0.0; @@ -120,7 +120,7 @@ public class BlueNormals { return f; } - private static attackPart blueCrouchAstartup() { + protected static attackPart blueCrouchAstartup() { Frame[] f = new Frame[4]; f[0] = crouchAFrame1(); f[1] = crouchAFrame1(); @@ -129,7 +129,7 @@ public class BlueNormals { return(new attackPart(f)); } - private static attackPart blueCrouchArecovery() { + protected static attackPart blueCrouchArecovery() { Frame[] f = new Frame[5]; f[0] = crouchAFrame3(); f[1] = crouchAFrame3(); @@ -139,7 +139,7 @@ public class BlueNormals { return(new attackPart(f)); } - private static attackPart blueCrouchAactive() { + protected static attackPart blueCrouchAactive() { Frame[] f = new Frame[3]; f[0] = crouchAFrame2(); f[1] = crouchAFrame2(); @@ -155,7 +155,7 @@ public class BlueNormals { return new Attack(isSpecial,rS,cmd,parts); } - private static Frame crouchCFrame1() { + protected static Frame crouchCFrame1() { //movement data double moveX = 0.0; double moveY = 0.0; @@ -221,7 +221,7 @@ public class BlueNormals { return f; } - private static Frame crouchCFrame3() { + protected static Frame crouchCFrame3() { Passive_HitBox bStandPHB1 = new Passive_HitBox(300,-200,150,500); Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(200,-600,280,100); Push_HitBox bStandPB1 = new Push_HitBox(270,-170,180,540); @@ -238,7 +238,7 @@ public class BlueNormals { return f; } - private static Frame crouchCFrame4() { + protected static Frame crouchCFrame4() { //movement data double moveX = 0.0; double moveY = 0.0; @@ -271,7 +271,7 @@ public class BlueNormals { return f; } - private static Frame crouchCFrame5() { + protected static Frame crouchCFrame5() { //movement data double moveX = 0.0; double moveY = 0.0; @@ -304,7 +304,7 @@ public class BlueNormals { return f; } - private static attackPart blueCrouchCstartup() { + protected static attackPart blueCrouchCstartup() { Frame[] f = new Frame[5]; f[0] = crouchCFrame1(); f[1] = crouchCFrame1(); @@ -314,7 +314,7 @@ public class BlueNormals { return(new attackPart(f)); } - private static attackPart blueCrouchCrecovery() { + protected static attackPart blueCrouchCrecovery() { Frame[] f = new Frame[19]; int i; for(i = 0; i < 10; i++) { @@ -326,7 +326,7 @@ public class BlueNormals { return(new attackPart(f)); } - private static attackPart blueCrouchCactive() { + protected static attackPart blueCrouchCactive() { Frame[] f = new Frame[5]; for(int i = 0; i < f.length; i++) { f[i] = crouchCFrame3(); @@ -342,7 +342,7 @@ public class BlueNormals { return new Attack(isSpecial,rS,cmd,parts); } - private static Frame standAFrame1(){ + protected static Frame standAFrame1(){ /* Hitboxes lists creation @@ -381,7 +381,7 @@ public class BlueNormals { return f; } - private static Frame standAFrame2(){ + protected static Frame standAFrame2(){ /* Hitboxes lists creation @@ -422,7 +422,7 @@ public class BlueNormals { return f; } - private static Frame standAFrame3(){ + protected static Frame standAFrame3(){ Passive_HitBox bStandPHB1 = new Passive_HitBox(200*1.25f,-200*1.25f,150*1.25f,150*1.25f); Passive_HitBox bStandPHB2 = new Passive_HitBox(220*1.25f,-300*1.25f,75*1.25f,150*1.25f); @@ -443,7 +443,7 @@ public class BlueNormals { return blueStandframe1; } - private static attackPart blueStandAstartup() { + protected static attackPart blueStandAstartup() { Frame[] f = new Frame[3]; f[0] = standAFrame1(); f[1] = standAFrame1(); @@ -451,7 +451,7 @@ public class BlueNormals { return(new attackPart(f)); } - private static attackPart blueStandArecovery() { + protected static attackPart blueStandArecovery() { Frame[] f = new Frame[5]; f[0] = standAFrame3(); f[1] = standAFrame3(); @@ -461,7 +461,7 @@ public class BlueNormals { return(new attackPart(f)); } - private static attackPart blueStandAactive() { + protected static attackPart blueStandAactive() { Frame[] f = new Frame[3]; f[0] = standAFrame2(); f[1] = standAFrame2(); @@ -477,7 +477,7 @@ public class BlueNormals { return new Attack(isSpecial,rS,cmd,parts); } - private static Frame standDFrame1(){ + protected static Frame standDFrame1(){ /* Hitboxes lists creation @@ -490,16 +490,23 @@ public class BlueNormals { /* Individual hitboxes creation */ - Passive_HitBox phb1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox pushB = new Push_HitBox(70,70,150,500); + Passive_HitBox pHB1 = new Passive_HitBox(200*1.25f,-200*1.25f,150*1.25f,150*1.25f); + Passive_HitBox pHB2 = new Passive_HitBox(220*1.25f,-300*1.25f,100*1.25f,150*1.25f); + Passive_HitBox pHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox pHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox pushB = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); /* adding hitboxes to lists */ - phb.add(phb1); + phb.add(pHB1); + phb.add(pHB4); + phb.add(pHB3); + phb.add(pHB2); pthb.add(pthb1); + /* frame creation */ @@ -510,7 +517,7 @@ public class BlueNormals { return f; } - private static Frame standDFrame2(){ + protected static Frame standDFrame2(){ /* Hitboxes lists creation @@ -520,19 +527,26 @@ public class BlueNormals { ArrayList ahb = new ArrayList(); ArrayList athb = new ArrayList(); - /* - Individual hitboxes creation - */ - Passive_HitBox phb1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox pushB = new Push_HitBox(70,70,150,500); + Passive_HitBox pHB1 = new Passive_HitBox(200*1.25f,-200*1.25f,150*1.25f,150*1.25f); + Passive_HitBox pHB2 = new Passive_HitBox(220*1.25f,-300*1.25f,100*1.25f,150*1.25f); + Passive_HitBox pHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox pHB4 = new Passive_HitBox(250*1.25f,-130*1.25f,50*1.25f,70*1.25f); + Passive_HitBox pHB5 = new Passive_HitBox(350*1.25f,-230*1.25f,50*1.25f,70*1.25f); + Passive_HitBox pHB6 = new Passive_HitBox(400*1.25f,-180*1.25f,50*1.25f,70*1.25f); + + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox pushB = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); /* adding hitboxes to lists */ - phb.add(phb1); + phb.add(pHB1); + phb.add(pHB4); + phb.add(pHB3); + phb.add(pHB2); + phb.add(pHB5); + phb.add(pHB6); pthb.add(pthb1); - /* frame creation */ @@ -543,7 +557,7 @@ public class BlueNormals { return f; } - private static Frame standDFrame3(){ + protected static Frame standDFrame3(){ /* Hitboxes lists creation @@ -556,15 +570,28 @@ public class BlueNormals { /* Individual hitboxes creation */ - Passive_HitBox phb1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox pushB = new Push_HitBox(70,70,150,500); + Passive_HitBox phb1 = new Passive_HitBox(300,-150,150,550); + Passive_HitBox phb2 = new Passive_HitBox(150,-180,250,350); + Passive_HitBox phb3 = new Passive_HitBox(450,-250,150,70); + Passive_HitBox phb5 = new Passive_HitBox(450,-320,40,70); + Passive_HitBox phb4 = new Passive_HitBox(550,-180,100,100); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(250,-600,250,100); + Push_HitBox pushB = new Push_HitBox(300,-200,150,500); + + Active_HitBox ahb1 = new Active_HitBox(500,-110,220,220); + Active_HitBox ahb2 = new Active_HitBox(400,-300,120,120); /* adding hitboxes to lists */ phb.add(phb1); + phb.add(phb3); + phb.add(phb2); + phb.add(phb5); + phb.add(phb4); pthb.add(pthb1); + ahb.add(ahb1); + ahb.add(ahb2); /* frame creation @@ -576,7 +603,7 @@ public class BlueNormals { return f; } - private static Frame standDFrame4(){ + protected static Frame standDFrame4(){ /* Hitboxes lists creation @@ -586,19 +613,26 @@ public class BlueNormals { ArrayList ahb = new ArrayList(); ArrayList athb = new ArrayList(); - /* - Individual hitboxes creation - */ - Passive_HitBox phb1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox pushB = new Push_HitBox(70,70,150,500); + Passive_HitBox pHB1 = new Passive_HitBox(200*1.25f,-200*1.25f,150*1.25f,150*1.25f); + Passive_HitBox pHB2 = new Passive_HitBox(220*1.25f,-300*1.25f,100*1.25f,150*1.25f); + Passive_HitBox pHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox pHB4 = new Passive_HitBox(250*1.25f,-130*1.25f,50*1.25f,70*1.25f); + Passive_HitBox pHB5 = new Passive_HitBox(350*1.25f,-230*1.25f,50*1.25f,70*1.25f); + Passive_HitBox pHB6 = new Passive_HitBox(400*1.25f,-180*1.25f,50*1.25f,70*1.25f); + + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox pushB = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); /* adding hitboxes to lists */ - phb.add(phb1); + phb.add(pHB1); + phb.add(pHB4); + phb.add(pHB3); + phb.add(pHB2); + phb.add(pHB5); + phb.add(pHB6); pthb.add(pthb1); - /* frame creation */ @@ -609,7 +643,7 @@ public class BlueNormals { return f; } - private static attackPart blueStandDstartup() { + protected static attackPart blueStandDstartup() { Frame[] f = new Frame[8]; for(int i = 0; i < 5; i++) { f[i] = standDFrame1(); @@ -620,7 +654,7 @@ public class BlueNormals { return(new attackPart(f)); } - private static attackPart blueStandDactive() { + protected static attackPart blueStandDactive() { Frame[] f = new Frame[5]; for(int i = 0; i < f.length; i++) { f[i] = standDFrame3(); @@ -628,7 +662,7 @@ public class BlueNormals { return(new attackPart(100,0,20,18,16,14,f,false,false,false)); } - private static attackPart blueStandDrecovery() { + protected static attackPart blueStandDrecovery() { Frame[] f = new Frame[18]; for(int i = 0; i < f.length; i++) { f[i] = standDFrame4(); @@ -643,7 +677,7 @@ public class BlueNormals { attackPart[] parts = {blueStandDstartup(),blueStandDactive(),blueStandDrecovery()}; return new Attack(isSpecial,rS,cmd,parts); } - private static Frame ForwardDFrame0() { + protected static Frame ForwardDFrame0() { //movement data double moveX = 3.0; double moveY = 0.0; @@ -670,7 +704,7 @@ public class BlueNormals { f.setSpriteWrap((138*5),(138*4),138,138); return f; } - private static Frame ForwardDFrame1(){ + protected static Frame ForwardDFrame1(){ //movement data double moveX = 0.0; double moveY = 0.0; @@ -698,7 +732,7 @@ public class BlueNormals { return f; } - private static Frame ForwardDFrame2(){ + protected static Frame ForwardDFrame2(){ //movement data double moveX = 0.0; double moveY = 0.0; @@ -726,7 +760,7 @@ public class BlueNormals { return f; } - private static Frame ForwardDFrame3(){ + protected static Frame ForwardDFrame3(){ //movement data double moveX = 0.0; double moveY = 0.0; @@ -754,7 +788,7 @@ public class BlueNormals { return f; } - private static Frame ForwardDFrame4(){ + protected static Frame ForwardDFrame4(){ //movement data double moveX = 0.0; double moveY = 0.0; @@ -782,7 +816,7 @@ public class BlueNormals { return f; } - private static Frame ForwardDFrame5(){ + protected static Frame ForwardDFrame5(){ //movement data double moveX = 0.0; double moveY = 0.0; @@ -810,7 +844,7 @@ public class BlueNormals { return f; } - private static attackPart blueForwardDstartup() { + protected static attackPart blueForwardDstartup() { Frame[] f = new Frame[18]; for (int i = 0; i < 3 ; i++) { f[i] = ForwardDFrame0(); @@ -824,7 +858,7 @@ public class BlueNormals { return (new attackPart(f)); } - private static attackPart blueForwardDrecovery() { + protected static attackPart blueForwardDrecovery() { Frame[] f = new Frame[8]; for (int i = 0; i < 3; i++) { f[i] = ForwardDFrame4(); @@ -835,7 +869,7 @@ public class BlueNormals { return (new attackPart(f)); } - private static attackPart blueForwardDactive() { + protected static attackPart blueForwardDactive() { Frame[] f = new Frame[4]; for (int i = 0; i < f.length; i++) { f[i] = ForwardDFrame3(); @@ -843,7 +877,7 @@ public class BlueNormals { return(new attackPart(30,0,5,5,0,0,f,false,true,false)); } - private static attackPart blueForwardDactive2() { + protected static attackPart blueForwardDactive2() { Frame[] f = new Frame[3]; for (int i = 0; i < f.length; i++) { f[i] = ForwardDFrame4(); From a0a5b015f1cbe0c2287643447b4e12844877c4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o?= Date: Wed, 23 Jun 2021 18:38:14 +0200 Subject: [PATCH 03/10] little text when a player win a round + at the begining of the second round players are in the right places --- src/gameplay/match/match.java | 36 ++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index ff0275a..6e6a1fa 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -81,9 +81,10 @@ public class match { private static UIElementText timerUI; private static UIElementText fpsCounter; private static UIInputList inputListP1; + private static UIElementText roundWon; // Debug - public static boolean showP1Hitbox = false; + public static boolean showP1Hitbox = false; // TODO modifier pour le rendre activable public static boolean showP2Hitbox = false; private static List listHitboxObj = new ArrayList<>(); private static float slowFactor = 1f; @@ -128,14 +129,43 @@ public class match { * Ends the round. * Used for playing animations and such. * TODO : Implement this once we know what to do. + * @throws InterruptedException */ - private static void endRound() { + private static void endRound() throws InterruptedException { if(roundP1) { + //texte de victoire System.out.println("P1 won the round"); + roundWon = new UIElementText("Player1 won the round", 5f, 0.25f, 0.5f, 100f, engine); + roundWon.setBackground(new Vector3f(0f,0f,0f)); + engine.add_uiElement(roundWon); + engine.update(); + engine.render(); + Thread.sleep(1000); + engine.remove_uiElement(roundWon); + + //replacement des sprites + objP1.translate(new Vector3f(-p1.getPosX(), -p1.getPosY())); + objP2.translate(new Vector3f(-p2.getPosX(), -p2.getPosY())); + objP1.getShadow().translate(new Vector3f(0f,-p1.getPosY(),0)); + objP2.getShadow().translate(new Vector3f(0f,-p2.getPosY(),0)); } else { + //texte de victoire System.out.println("P2 won the round"); + roundWon = new UIElementText("Player2 won the round", 5f, 0.25f, 0.5f, 100f, engine); + roundWon.setBackground(new Vector3f(0f,0f,0f)); + engine.add_uiElement(roundWon); + engine.update(); + engine.render(); + Thread.sleep(1000); + engine.remove_uiElement(roundWon); + + //replacement des sprites + objP1.translate(new Vector3f(-p1.getPosX(), -p1.getPosY())); + objP2.translate(new Vector3f(-p2.getPosX(), -p2.getPosY())); + objP1.getShadow().translate(new Vector3f(0f,-p1.getPosY(),0)); + objP2.getShadow().translate(new Vector3f(0f,-p2.getPosY(),0)); } } @@ -298,7 +328,7 @@ public class match { } - private static void ac(int i) { + private static void ac(int i) throws InterruptedException { // System.out.println(i); switch (i) { From 7dd455740fe86402587349dc431088c6ba8cc08e Mon Sep 17 00:00:00 2001 From: Azra Victor Date: Wed, 23 Jun 2021 19:21:40 +0200 Subject: [PATCH 04/10] Added handling of jump arc during jump attacks. --- src/gameplay/frames/Frame.java | 18 ++++++++++++++++++ src/gameplay/frames/nextFrameBuffer.java | 23 +++++++++++++++++++++++ src/gameplay/match/match.java | 7 +++++++ 3 files changed, 48 insertions(+) diff --git a/src/gameplay/frames/Frame.java b/src/gameplay/frames/Frame.java index 7a94eb9..2d0421b 100644 --- a/src/gameplay/frames/Frame.java +++ b/src/gameplay/frames/Frame.java @@ -225,4 +225,22 @@ public class Frame { public int[] getSprite() { return sprite; } + + /** + * This becomes a clone of a given frame, except for the movement data. + * Usueful for jump attack + * @param f the frame to clone + */ + public void cloneWithoutMovement(Frame f) { + this.cloneArray(f); //Il faut cloner individuellement chaque hitbox des differentes listes pour ne pas garder les pointeurs + Push_HitBox phb = f.getPushHitBox(); + this.setPushHitBox(new Push_HitBox(phb.getPosX(), phb.getPosY(), phb.getSize_x(), phb.getSize_y())); + this.normalCancellable = f.isNormalCancellable(); + this.specialCancellable = f.isSpecialCancellable(); + this.jumpCancellable = f.jumpCancellable; + this.moveCancellable = f.isMoveCancellable(); + this.isDashCancellable = f.isDashCancellable; + this.lastFrameOfHit = f.islastFrameOfHit(); + this.setSpriteWrap(f.sprite[0], f.sprite[1], f.sprite[2], f.sprite[3]); + } } diff --git a/src/gameplay/frames/nextFrameBuffer.java b/src/gameplay/frames/nextFrameBuffer.java index f9ac911..c87919f 100644 --- a/src/gameplay/frames/nextFrameBuffer.java +++ b/src/gameplay/frames/nextFrameBuffer.java @@ -1,5 +1,7 @@ package gameplay.frames; +import java.util.ArrayList; + /** * This will handle the next frames to be played by each entity. * @author Victor Azra @@ -76,4 +78,25 @@ public class nextFrameBuffer { } } + /** + * Copies the same amount of frames from f in this, as the amount originally present, but keepsoriginal move data + * @param f frames array to copy + */ + public void changeFramesExceptForMove(ArrayList f) { + int i = 0; + boolean goOn = true; + nextFrameBuffer fb = new nextFrameBuffer(); + fb.clone(this); + this.emptyQueue(); + try{fb.goToNext();} catch(IndexOutOfBoundsException e) {goOn = false;} + while(goOn && i < f.size()) { + try{ + fb.current.cloneWithoutMovement(f.get(i)); + this.addFrameToQueue(fb.current); + fb.goToNext(); + i++; + } catch(IndexOutOfBoundsException e) { goOn = false;} + } + } + } diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index 3a5d3d3..eb4f11a 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -18,6 +18,7 @@ import gameplay.actions.Throw; import gameplay.actions.ThrowPart; import gameplay.entities.Status; import gameplay.frames.Frame; +import gameplay.frames.nextFrameBuffer; import gameplay.hitboxes.*; import gameplay.input.InputBuffer; import gameplay.entities.Character; @@ -464,6 +465,12 @@ public class match { && ((atk.isSpecial() && c.getCurrentframe().isSpecialCancellable()) || (!atk.isSpecial() && c.getCurrentframe().isNormalCancellable())); if(attackIsPossible) { + if(c.getStatus() == Status.JUMPING) { + nextFrameBuffer nJumpFb = new nextFrameBuffer(); + nJumpFb.clone(c.getFrames()); + nJumpFb.changeFramesExceptForMove(atk.getFrame()); + c.setFrames(nJumpFb); + } c.clearNextFrames(); c.addNextFramesList(atk.getFrame()); c.setAttackPartsArray(atk.getParts()); From 23bc9aabcdacbb8fd4b65d322cfe48eb729fa12a Mon Sep 17 00:00:00 2001 From: Azra Victor Date: Wed, 23 Jun 2021 19:35:18 +0200 Subject: [PATCH 05/10] Fix of jump arcs hopefully --- src/gameplay/Characters/Blue/BlueBaseFrames.java | 2 +- src/gameplay/frames/Frame.java | 15 +++++---------- src/gameplay/frames/nextFrameBuffer.java | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/gameplay/Characters/Blue/BlueBaseFrames.java b/src/gameplay/Characters/Blue/BlueBaseFrames.java index 849f43e..9b215e7 100644 --- a/src/gameplay/Characters/Blue/BlueBaseFrames.java +++ b/src/gameplay/Characters/Blue/BlueBaseFrames.java @@ -1022,7 +1022,7 @@ public class BlueBaseFrames { String path = "textures/Sprite_sans_grille_9comp.png"; String pathToBG = "textures/arena1.png"; - Frame f = BlueNormals.ForwardDFrame0(); + Frame f = BlueNormals.crouchCFrame2(); ObjectGl blue = new ObjectGl(0f, 138f, 138f, 5f, path, null); diff --git a/src/gameplay/frames/Frame.java b/src/gameplay/frames/Frame.java index 2d0421b..f9086a9 100644 --- a/src/gameplay/frames/Frame.java +++ b/src/gameplay/frames/Frame.java @@ -232,15 +232,10 @@ public class Frame { * @param f the frame to clone */ public void cloneWithoutMovement(Frame f) { - this.cloneArray(f); //Il faut cloner individuellement chaque hitbox des differentes listes pour ne pas garder les pointeurs - Push_HitBox phb = f.getPushHitBox(); - this.setPushHitBox(new Push_HitBox(phb.getPosX(), phb.getPosY(), phb.getSize_x(), phb.getSize_y())); - this.normalCancellable = f.isNormalCancellable(); - this.specialCancellable = f.isSpecialCancellable(); - this.jumpCancellable = f.jumpCancellable; - this.moveCancellable = f.isMoveCancellable(); - this.isDashCancellable = f.isDashCancellable; - this.lastFrameOfHit = f.islastFrameOfHit(); - this.setSpriteWrap(f.sprite[0], f.sprite[1], f.sprite[2], f.sprite[3]); + double moveX = this.move_x; + double moveY = this.move_y; + this.clone(f); + this.setMove_x(moveX); + this.setMove_y(moveY); } } diff --git a/src/gameplay/frames/nextFrameBuffer.java b/src/gameplay/frames/nextFrameBuffer.java index c87919f..1bd2247 100644 --- a/src/gameplay/frames/nextFrameBuffer.java +++ b/src/gameplay/frames/nextFrameBuffer.java @@ -88,14 +88,14 @@ public class nextFrameBuffer { nextFrameBuffer fb = new nextFrameBuffer(); fb.clone(this); this.emptyQueue(); - try{fb.goToNext();} catch(IndexOutOfBoundsException e) {goOn = false;} + try{fb.goToNext();} catch(NullPointerException e) {goOn = false;} while(goOn && i < f.size()) { try{ fb.current.cloneWithoutMovement(f.get(i)); this.addFrameToQueue(fb.current); fb.goToNext(); i++; - } catch(IndexOutOfBoundsException e) { goOn = false;} + } catch(NullPointerException e) { goOn = false;} } } From 0f430e5980d1cf903f60561c52f15d62758559f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o?= Date: Wed, 23 Jun 2021 20:22:22 +0200 Subject: [PATCH 06/10] endRound finished --- src/gameplay/match/match.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index 6e6a1fa..e6ce01c 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -138,12 +138,13 @@ public class match { System.out.println("P1 won the round"); roundWon = new UIElementText("Player1 won the round", 5f, 0.25f, 0.5f, 100f, engine); roundWon.setBackground(new Vector3f(0f,0f,0f)); + roundWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true); engine.add_uiElement(roundWon); engine.update(); engine.render(); Thread.sleep(1000); engine.remove_uiElement(roundWon); - + //replacement des sprites objP1.translate(new Vector3f(-p1.getPosX(), -p1.getPosY())); objP2.translate(new Vector3f(-p2.getPosX(), -p2.getPosY())); @@ -155,6 +156,7 @@ public class match { System.out.println("P2 won the round"); roundWon = new UIElementText("Player2 won the round", 5f, 0.25f, 0.5f, 100f, engine); roundWon.setBackground(new Vector3f(0f,0f,0f)); + roundWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true); engine.add_uiElement(roundWon); engine.update(); engine.render(); From 3170c713bd5b210ce98e509f7f4b83faec52b562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o?= Date: Wed, 23 Jun 2021 20:30:14 +0200 Subject: [PATCH 07/10] endRound finished --- src/gameplay/match/match.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index c83e527..4759f75 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -135,7 +135,7 @@ public class match { private static void endRound() throws InterruptedException { if(roundP1) { - //texte de victoire + //texte de victoire System.out.println("P1 won the round"); roundWon = new UIElementText("Player1 won the round", 5f, 0.25f, 0.5f, 100f, engine); roundWon.setBackground(new Vector3f(0f,0f,0f)); From 56fca86614fd5eb53fd79bf373f393154d6c7eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o?= Date: Wed, 23 Jun 2021 20:44:13 +0200 Subject: [PATCH 08/10] connection test --- src/gameplay/match/match.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index 4759f75..a64dcfb 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -135,7 +135,7 @@ public class match { private static void endRound() throws InterruptedException { if(roundP1) { - //texte de victoire + //texte de victoire System.out.println("P1 won the round"); roundWon = new UIElementText("Player1 won the round", 5f, 0.25f, 0.5f, 100f, engine); roundWon.setBackground(new Vector3f(0f,0f,0f)); From f1eb93c6477a7a65bfadb3ee7e3871af96e2c148 Mon Sep 17 00:00:00 2001 From: Azra Victor Date: Wed, 23 Jun 2021 20:05:39 +0200 Subject: [PATCH 09/10] changed nextframebuffer.clone() so it hopefully won't crash --- src/gameplay/frames/nextFrameBuffer.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/gameplay/frames/nextFrameBuffer.java b/src/gameplay/frames/nextFrameBuffer.java index 1bd2247..6d6cb3f 100644 --- a/src/gameplay/frames/nextFrameBuffer.java +++ b/src/gameplay/frames/nextFrameBuffer.java @@ -24,8 +24,21 @@ public class nextFrameBuffer { } public void clone(nextFrameBuffer f) { - this.current = f.current; - this.next = f.next; + + try{ + Frame cf = new Frame(); + cf.clone(f.current); + this.current = cf; } + catch (NullPointerException n) { + this.current = null; + this.next = null; + } + nextFrameBuffer nfb = new nextFrameBuffer(); + try { + nfb.clone(f.next); + } catch (NullPointerException n) {} + this.next = nfb; + } public void setNext(nextFrameBuffer f) { From ae41d2131b7e419bde777a10933bcb0f31eda050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o?= Date: Wed, 23 Jun 2021 20:47:37 +0200 Subject: [PATCH 10/10] shader removed on the endRound message --- src/gameplay/match/match.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index a64dcfb..12c9c61 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -139,7 +139,6 @@ public class match { System.out.println("P1 won the round"); roundWon = new UIElementText("Player1 won the round", 5f, 0.25f, 0.5f, 100f, engine); roundWon.setBackground(new Vector3f(0f,0f,0f)); - roundWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true); engine.add_uiElement(roundWon); engine.update(); engine.render(); @@ -157,7 +156,6 @@ public class match { System.out.println("P2 won the round"); roundWon = new UIElementText("Player2 won the round", 5f, 0.25f, 0.5f, 100f, engine); roundWon.setBackground(new Vector3f(0f,0f,0f)); - roundWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true); engine.add_uiElement(roundWon); engine.update(); engine.render();