diff --git a/src/engine/Engine.java b/src/engine/Engine.java index 999fab6..c6c3ceb 100644 --- a/src/engine/Engine.java +++ b/src/engine/Engine.java @@ -183,6 +183,7 @@ public class Engine { } public void remove_objectGl(ObjectGl obj) { + obj.delete(); this.objectsGl.remove(obj); } diff --git a/src/engine/graphics/VertexArray.java b/src/engine/graphics/VertexArray.java index a3626be..289119a 100644 --- a/src/engine/graphics/VertexArray.java +++ b/src/engine/graphics/VertexArray.java @@ -86,4 +86,15 @@ public class VertexArray { unbind(); } + /** + * Delete every buffers used + */ + public void delete(){ + glDeleteBuffers(VBO); + glDeleteBuffers(EBO); + glDeleteBuffers(CBO); + glDeleteBuffers(TBO); + glDeleteVertexArrays(VAO); + } + } diff --git a/src/engine/input/KeyboardInput.java b/src/engine/input/KeyboardInput.java index 5356a5d..4ea08c9 100644 --- a/src/engine/input/KeyboardInput.java +++ b/src/engine/input/KeyboardInput.java @@ -3,6 +3,7 @@ package engine.input; import engine.Engine; import engine.math.Vector3f; import engine.object.ObjectGl; +import gameplay.match.match; import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFWKeyCallback; @@ -24,6 +25,10 @@ public class KeyboardInput extends GLFWKeyCallback { else if(key == GLFW_KEY_SPACE && action == GLFW_PRESS) //Switch to wireframe if (glGetInteger(GL_POLYGON_MODE) == GL_FILL) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); else glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + else if(key == GLFW_KEY_K && action == GLFW_PRESS){ + match.showP1Hitbox = !match.showP1Hitbox; + match.showP2Hitbox = !match.showP2Hitbox; + } } public static boolean isKeyDown(int keyCode) { diff --git a/src/engine/object/ObjectGl.java b/src/engine/object/ObjectGl.java index a4d7edb..5d1426b 100644 --- a/src/engine/object/ObjectGl.java +++ b/src/engine/object/ObjectGl.java @@ -291,4 +291,8 @@ public class ObjectGl { this.shader.disable(); } + public void delete(){ + this.vertexArray.delete(); + } + } diff --git a/src/engine/utils/BufferUtilsEngine.java b/src/engine/utils/BufferUtilsEngine.java index 14ccc53..5adf701 100644 --- a/src/engine/utils/BufferUtilsEngine.java +++ b/src/engine/utils/BufferUtilsEngine.java @@ -1,12 +1,9 @@ package engine.utils; -import java.io.IOException; -import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import java.nio.channels.FileChannel; public class BufferUtilsEngine { diff --git a/src/gameplay/Characters/Blue/BlueBaseFrames.java b/src/gameplay/Characters/Blue/BlueBaseFrames.java index 653e7b1..f0476a7 100644 --- a/src/gameplay/Characters/Blue/BlueBaseFrames.java +++ b/src/gameplay/Characters/Blue/BlueBaseFrames.java @@ -44,12 +44,12 @@ public class BlueBaseFrames { } */ private static Frame generateStandFrame1(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,75,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(250,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(200,-500,200,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + Passive_HitBox bStandPHB1 = new Passive_HitBox(250,-250,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB2 = new Passive_HitBox(220*1.25f,-300*1.25f,75*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(250*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(200*1.25f,-500*1.25f,200*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -64,12 +64,12 @@ public class BlueBaseFrames { } private static Frame generateStandFrame2(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,75,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(250,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(200,-500,200,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(250*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(200*1.25f,-500*1.25f,200*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -84,13 +84,13 @@ public class BlueBaseFrames { } protected static Frame[] blueStandFrames() { - Frame[] sf = new Frame[6]; - sf[0] = generateStandFrame1(); - sf[1] = generateStandFrame1(); - sf[2] = generateStandFrame1(); - sf[3] = generateStandFrame2(); - sf[4] = generateStandFrame2(); - sf[5] = generateStandFrame2(); + Frame[] sf = new Frame[24]; + for (int i = 0; i < 12; i++){ + sf[i] = generateStandFrame1(); + } + for (int i = 12; i < sf.length; i++){ + sf[i] = generateStandFrame2(); + } return sf; } @@ -113,10 +113,10 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB = new Push_HitBox(140,-250,280,300); - Passive_HitBox phb1 = new Passive_HitBox(200,-250,200,300); - Passive_HitBox phb2 = new Passive_HitBox(260,-200,80,50); - Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150,-500,300,70); + Push_HitBox pB = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-250*1.25f,200*1.25f,300*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-200*1.25f,80*1.25f,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,300*1.25f,70*1.25f); pthb.add(pthb1); phb.add(phb1); phb.add(phb2); @@ -151,12 +151,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,90,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(280,-20,70,100); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,90*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(280*1.25f,-20*1.25f,70*1.25f,100*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -189,12 +189,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,90,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(280,-20,70,100); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,90*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(280*1.25f,-20*1.25f,70*1.25f,100*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -209,11 +209,11 @@ public class BlueBaseFrames { } protected static Frame[] blueNeutralJump() { - Frame[] jF = new Frame[40]; - for(int i = 0; i < jF.length/2; i++) { + Frame[] jF = new Frame[39]; + for(int i = 0; i < 20; i++) { jF[i] = generateNeutralJumpFrame1(); } - for(int i = jF.length/2; i < jF.length; i++) { + for(int i = 20; i < jF.length; i++) { jF[i] = generateNeutralJumpFrame2(); } return jF; @@ -238,12 +238,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,150,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(210,-430,70,70); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,150*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(210*1.25f,-430*1.25f,70*1.25f,70*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -276,12 +276,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,90,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(280,-20,70,100); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,90*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(280*1.25f,-20*1.25f,70*1.25f,100*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -314,12 +314,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,90,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(280,-20,70,100); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,90*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(280*1.25f,-20*1.25f,70*1.25f,100*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -352,12 +352,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,150,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(210,-430,70,70); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,150*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(210*1.25f,-430*1.25f,70*1.25f,70*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -372,17 +372,17 @@ public class BlueBaseFrames { } protected static Frame[] blueForwardJump() { - Frame[] jF = new Frame[40]; - for(int i = 0; i < jF.length/4; i++) { + Frame[] jF = new Frame[39]; + for(int i = 0; i < 10; i++) { jF[i] = GenerateForwardJumpFrame1(); } - for(int i = jF.length/4; i < jF.length/2; i++) { + for(int i = 10; i < 20; i++) { jF[i] = GenerateForwardJumpFrame2(); } - for(int i = jF.length/2; i < jF.length * 0.75; i++) { + for(int i = 20; i < 30; i++) { jF[i] = GenerateForwardJumpFrame3(); } - for(int i = (int) (jF.length * 0.75); i < jF.length; i++) { + for(int i = 30; i < jF.length; i++) { jF[i] = GenerateForwardJumpFrame4(); } return jF; @@ -407,12 +407,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,150,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(210,-430,70,70); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,150*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(210*1.25f,-430*1.25f,70*1.25f,70*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -445,12 +445,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,90,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(280,-20,70,100); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,90*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(280*1.25f,-20*1.25f,70*1.25f,100*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -483,12 +483,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,90,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(280,-20,70,100); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,90*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(280*1.25f,-20*1.25f,70*1.25f,100*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -521,12 +521,12 @@ public class BlueBaseFrames { ArrayList pthb = new ArrayList(); //generate hitboxes here and then use ArrayList add method to add them to the correct list - Push_HitBox pB1 = new Push_HitBox(200,-20,160,400); - Passive_HitBox phb1 = new Passive_HitBox(180,-100,170,200); - Passive_HitBox phb2 = new Passive_HitBox(210,-350,150,80); - Passive_HitBox phb3 = new Passive_HitBox(230,-200,140,160); - Passive_HitBox phb4 = new Passive_HitBox(230,-50,70,50); - Passive_HitBox phb5 = new Passive_HitBox(210,-430,70,70); + Push_HitBox pB1 = new Push_HitBox(200*1.25f,-20*1.25f,160*1.25f,400*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(180*1.25f,-100*1.25f,170*1.25f,200*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-350*1.25f,150*1.25f,80*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-200*1.25f,140*1.25f,160*1.25f); + Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-50*1.25f,70*1.25f,50*1.25f); + Passive_HitBox phb5 = new Passive_HitBox(210*1.25f,-430*1.25f,70*1.25f,70*1.25f); phb.add(phb1); phb.add(phb2); phb.add(phb3); @@ -541,17 +541,17 @@ public class BlueBaseFrames { } protected static Frame[] blueBackJump() { - Frame[] jF = new Frame[40]; - for(int i = 0; i < jF.length/4; i++) { + Frame[] jF = new Frame[39]; + for(int i = 0; i < 10; i++) { jF[i] = BackJumpFrame1(); } - for(int i = jF.length/4; i < jF.length/2; i++) { + for(int i = 10; i < 20; i++) { jF[i] = BackJumpFrame2(); } - for(int i = jF.length/2; i < jF.length * 0.75; i++) { + for(int i = 20; i < 30; i++) { jF[i] = BackJumpFrame3(); } - for(int i = (int) (jF.length * 0.75); i < jF.length; i++) { + for(int i = 30; i < jF.length; i++) { jF[i] = BackJumpFrame4(); } return jF; @@ -559,12 +559,12 @@ public class BlueBaseFrames { private static Frame walkForwardFrame1(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,100,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(280,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150,-500,220,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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,100*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -579,12 +579,12 @@ public class BlueBaseFrames { } private static Frame walkForwardFrame2(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,100,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(280,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150,-500,220,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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,100*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -599,12 +599,12 @@ public class BlueBaseFrames { } private static Frame walkForwardFrame3(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,100,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(280,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150,-500,220,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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,100*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -619,12 +619,12 @@ public class BlueBaseFrames { } private static Frame walkForwardFrame4(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,100,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(280,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150,-500,220,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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,100*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -638,6 +638,7 @@ public class BlueBaseFrames { return blueStandframe1; } + // TODO avoir plusieurs sprite pour crée un cycle de marche protected static Frame[] blueFWalk() { Frame[] f = new Frame[12]; f[0] = walkForwardFrame1(); @@ -652,18 +653,17 @@ public class BlueBaseFrames { f[9] = walkForwardFrame4(); f[10] = walkForwardFrame4(); f[11] = walkForwardFrame4(); - return f; } private static Frame walkBackFrame4(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,100,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(280,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150,-500,220,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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,100*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -678,12 +678,12 @@ public class BlueBaseFrames { } private static Frame walkBackFrame3(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,100,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(280,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150,-500,220,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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,100*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -698,12 +698,12 @@ public class BlueBaseFrames { } private static Frame walkBackFrame2(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,100,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(280,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150,-500,220,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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,100*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -718,12 +718,12 @@ public class BlueBaseFrames { } private static Frame walkBackFrame1(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(200,-200,150,150); - Passive_HitBox bStandPHB2 = new Passive_HitBox(220,-300,100,150); - Passive_HitBox bStandPHB3 = new Passive_HitBox(200,-400,150,150); - Passive_HitBox bStandPHB4 = new Passive_HitBox(280,-150,50,50); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150,-500,220,70); - Push_HitBox bStandPB1 = new Push_HitBox(200,-150,160,400); + 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,100*1.25f,150*1.25f); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(280*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,220*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); phb.add(bStandPHB1); @@ -761,10 +761,10 @@ public class BlueBaseFrames { String path = "textures/Sprite_sans_grille_9comp.png"; String pathToBG = "textures/arena1.png"; - Frame f = walkForwardFrame4(); + Frame f = BlueMisc.blueCrouchGuard(); - ObjectGl blue = new ObjectGl(0f, 138f, 138f, 4f, path, null); + ObjectGl blue = new ObjectGl(0f, 138f, 138f, 5f, path, null); blue.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]); int posX = -750; diff --git a/src/gameplay/Characters/Blue/BlueMisc.java b/src/gameplay/Characters/Blue/BlueMisc.java index c0e92b7..f70297d 100644 --- a/src/gameplay/Characters/Blue/BlueMisc.java +++ b/src/gameplay/Characters/Blue/BlueMisc.java @@ -38,7 +38,7 @@ public class BlueMisc { Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushB, //cancels (in order : normal, special, jump, move, dash) false,false,false,false,false); - f.setSpriteWrap(102,0,102,120); + f.setSpriteWrap(14*138,139,138,138); // A 138 on voit les iepds du boug au dessus return f; } private static Frame fDash2() { @@ -69,7 +69,7 @@ public class BlueMisc { Frame f = new Frame(0.0,12.0,phb,ahb,pthb,athb,pushB, //cancels (in order : normal, special, jump, move, dash) false,false,false,false,false); - f.setSpriteWrap(816,0,102,120); + f.setSpriteWrap(14*138,139,138,138); return f; } private static Frame fDash3() { @@ -100,7 +100,7 @@ public class BlueMisc { Frame f = new Frame(0.0,6.0,phb,ahb,pthb,athb,pushB, //cancels (in order : normal, special, jump, move, dash) false,false,true,false,false); - f.setSpriteWrap(714,0,102,120); + f.setSpriteWrap(14*138,139,138,138); return f; } private static Frame fDash4() { @@ -131,7 +131,7 @@ public class BlueMisc { Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushB, //cancels (in order : normal, special, jump, move, dash) false,false,true,false,false); - f.setSpriteWrap(102,0,102,120); + f.setSpriteWrap(14*138,139,138,138); return f; } protected static Frame[] blueFDash() { @@ -172,7 +172,7 @@ public class BlueMisc { Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushB, //cancels (in order : normal, special, jump, move, dash) false,false,false,false,false); - f.setSpriteWrap(102,0,102,120); + f.setSpriteWrap(14*138,139,138,138); return f; } private static Frame bDash2() { @@ -203,7 +203,7 @@ public class BlueMisc { Frame f = new Frame(0.0,-12.0,phb,ahb,pthb,athb,pushB, //cancels (in order : normal, special, jump, move, dash) false,false,false,false,false); - f.setSpriteWrap(816,0,102,120); + f.setSpriteWrap(14*138,139,138,138); return f; } private static Frame bDash3() { @@ -234,7 +234,7 @@ public class BlueMisc { Frame f = new Frame(0.0,-6.0,phb,ahb,pthb,athb,pushB, //cancels (in order : normal, special, jump, move, dash) false,false,false,false,false); - f.setSpriteWrap(714,0,102,120); + f.setSpriteWrap(14*138,139,138,138); return f; } private static Frame bDash4() { @@ -265,7 +265,7 @@ public class BlueMisc { Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushB, //cancels (in order : normal, special, jump, move, dash) false,false,false,false,false); - f.setSpriteWrap(102,0,102,120); + f.setSpriteWrap(14*138,139,138,138); return f; } @@ -278,4 +278,145 @@ public class BlueMisc { while(c < f.length) {f[c] = bDash4(); c++;} return f; } + + protected static Frame blueStandHit(){ + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = false; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); + ArrayList phb = new ArrayList(); + ArrayList pthb = new ArrayList(); + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB1 = new Push_HitBox(170,-150,250,550); + Passive_HitBox pHB1 = new Passive_HitBox(150,-150,285,250); + Passive_HitBox pHB2 = new Passive_HitBox(180,-400,290,270); + + phb.add(pHB1); + phb.add(pHB2); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap(138*11,138*3,138,138); + return f; + } + + protected static Frame blueCrouchHit(){ + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = false; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); + ArrayList phb = new ArrayList(); + ArrayList pthb = new ArrayList(); + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB1 = new Push_HitBox(170,-250,250,450); + Passive_HitBox pHB1 = new Passive_HitBox(150,-250,285,150); + Passive_HitBox pHB2 = new Passive_HitBox(180,-500,290,200); + Passive_HitBox pHB3 = new Passive_HitBox(180,-400,190,170); + + phb.add(pHB1); + phb.add(pHB2); + phb.add(pHB3); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap(138*14,138*2,138,138); + return f; + } + + protected static Frame blueStandGuard(){ + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = false; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); + ArrayList phb = new ArrayList(); + ArrayList pthb = new ArrayList(); + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB1 = new Push_HitBox(170,-150,250,550); + Passive_HitBox pHB1 = new Passive_HitBox(220,-250,230,150); + Passive_HitBox pHB2 = new Passive_HitBox(250,-550,230,150); + Passive_HitBox pHB3 = new Passive_HitBox(270,-350,150,300); + Passive_HitBox pHB4 = new Passive_HitBox(280,-180,90,90); + + phb.add(pHB1); + phb.add(pHB2); + phb.add(pHB3); + phb.add(pHB4); + + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap(138*1,138*7,138,138); + return f; + } + + protected static Frame blueCrouchGuard(){ + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = false; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); + ArrayList phb = new ArrayList(); + ArrayList pthb = new ArrayList(); + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB1 = new Push_HitBox(240,-400,250,300); + Passive_HitBox pHB1 = new Passive_HitBox(310,-270,100,90); + Passive_HitBox pHB2 = new Passive_HitBox(200,-500,300,200); + Passive_HitBox pHB3 = new Passive_HitBox(220,-350,240,200); + + phb.add(pHB1); + phb.add(pHB2); + phb.add(pHB3); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap(138*14,138*4,138,138); + return f; + } } diff --git a/src/gameplay/Characters/Blue/BlueNormals.java b/src/gameplay/Characters/Blue/BlueNormals.java index 8211abe..23ffe7a 100644 --- a/src/gameplay/Characters/Blue/BlueNormals.java +++ b/src/gameplay/Characters/Blue/BlueNormals.java @@ -18,45 +18,106 @@ import static gameplay.input.ButtonIG.*; public class BlueNormals { private static Frame crouchAFrame1(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox bStandPB1 = new Push_HitBox(70,70,150,500); + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = false; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); - phb.add(bStandPHB1); - pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), - bStandPB1,false,false,false,false,false); - blueStandframe1.setSpriteWrap(0,(138*2),138,138); - return blueStandframe1; + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-250*1.25f,200*1.25f,300*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-200*1.25f,80*1.25f,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,300*1.25f,70*1.25f); + pthb.add(pthb1); + phb.add(phb1); + phb.add(phb2); + + Frame f = new Frame(moveX,moveY,phb,ahb,pthb,athb,pB,normalC,specialC,jumpC,moveC,dashC); + + f.setSpriteWrap(0,138*2,138,138); + return f; } private static Frame crouchAFrame2(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox bStandPB1 = new Push_HitBox(70,70,150,500); + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = false; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); - phb.add(bStandPHB1); - pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), - bStandPB1,false,false,false,false,false); - blueStandframe1.setSpriteWrap(138,(138*2),138,138); - return blueStandframe1; + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-250*1.25f,200*1.25f,300*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-200*1.25f,80*1.25f,50*1.25f); + Passive_HitBox phb3 = new Passive_HitBox(200*1.25f,-250*1.25f,400,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,300*1.25f,70*1.25f); + Active_HitBox ahb1 = new Active_HitBox(420,-300,250,90); + pthb.add(pthb1); + phb.add(phb1); + phb.add(phb2); + phb.add(phb3); + ahb.add(ahb1); + + Frame f = new Frame(moveX,moveY,phb,ahb,pthb,athb,pB,normalC,specialC,jumpC,moveC,dashC); + + f.setSpriteWrap(138,(138*2),138,138); + return f; } private static Frame crouchAFrame3(){ - Passive_HitBox bStandPHB1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox bStandPB1 = new Push_HitBox(70,70,150,500); + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = true; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); - phb.add(bStandPHB1); - pthb.add(bStandPTHB1); - Frame blueStandframe1 = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), - bStandPB1,false,true,false,false,false); - blueStandframe1.setSpriteWrap((138*2),(138*2),138,138); - return blueStandframe1; + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-250*1.25f,200*1.25f,300*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-200*1.25f,80*1.25f,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,300*1.25f,70*1.25f); + pthb.add(pthb1); + phb.add(phb1); + phb.add(phb2); + + Frame f = new Frame(moveX,moveY,phb,ahb,pthb,athb,pB,normalC,specialC,jumpC,moveC,dashC); + + f.setSpriteWrap(0,138*2,138,138); + return f; } private static attackPart blueCrouchAstartup() { @@ -95,72 +156,151 @@ public class BlueNormals { } private static Frame crouchCFrame1() { - Passive_HitBox bStandPHB1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox bStandPB1 = new Push_HitBox(70,70,150,500); + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = true; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); - phb.add(bStandPHB1); - pthb.add(bStandPTHB1); - Frame f = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), - bStandPB1,false,false,false,false,false); - f.setSpriteWrap((138*6),(138*2),138,138); + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-250*1.25f,200*1.25f,300*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-200*1.25f,80*1.25f,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,300*1.25f,70*1.25f); + pthb.add(pthb1); + phb.add(phb1); + phb.add(phb2); + + Frame f = new Frame(moveX,moveY,phb,ahb,pthb,athb,pB,normalC,specialC,jumpC,moveC,dashC); + + f.setSpriteWrap(138*0,138*2,138,138); return f; } - private static Frame crouchCFrame2() { - Passive_HitBox bStandPHB1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox bStandPB1 = new Push_HitBox(70,70,150,500); + protected static Frame crouchCFrame2() { + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = true; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); - phb.add(bStandPHB1); - pthb.add(bStandPTHB1); - Frame f = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), - bStandPB1,false,false,false,false,false); - f.setSpriteWrap((138*7),(138*2),138,138); + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-250*1.25f,200*1.25f,300*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-200*1.25f,80*1.25f,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,300*1.25f,70*1.25f); + pthb.add(pthb1); + phb.add(phb1); + phb.add(phb2); + + Frame f = new Frame(moveX,moveY,phb,ahb,pthb,athb,pB,normalC,specialC,jumpC,moveC,dashC); + + f.setSpriteWrap(138*7,138*2,138,138); return f; } private static Frame crouchCFrame3() { - Passive_HitBox bStandPHB1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox bStandPB1 = new Push_HitBox(70,70,150,500); + 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); + Active_HitBox ahb1 = new Active_HitBox(400,0,90,300); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); + ArrayList ahb = new ArrayList(); phb.add(bStandPHB1); pthb.add(bStandPTHB1); - Frame f = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), + ahb.add(ahb1); + Frame f = new Frame(0.0,0.0,phb,ahb,pthb,new ArrayList(), bStandPB1,false,false,false,false,false); f.setSpriteWrap((138*8),(138*2),138,138); return f; } private static Frame crouchCFrame4() { - Passive_HitBox bStandPHB1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox bStandPB1 = new Push_HitBox(70,70,150,500); + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = true; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); - phb.add(bStandPHB1); - pthb.add(bStandPTHB1); - Frame f = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), - bStandPB1,false,false,false,false,false); - f.setSpriteWrap((138*9),(138*2),138,138); + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-250*1.25f,200*1.25f,300*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-200*1.25f,80*1.25f,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,300*1.25f,70*1.25f); + pthb.add(pthb1); + phb.add(phb1); + phb.add(phb2); + + Frame f = new Frame(moveX,moveY,phb,ahb,pthb,athb,pB,normalC,specialC,jumpC,moveC,dashC); + + f.setSpriteWrap(138*9,138*2,138,138); return f; } private static Frame crouchCFrame5() { - Passive_HitBox bStandPHB1 = new Passive_HitBox(70,70,150,500); - Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(70,400,150,100); - Push_HitBox bStandPB1 = new Push_HitBox(70,70,150,500); + //movement data + double moveX = 0.0; + double moveY = 0.0; + + //cancelData + boolean normalC = false; + boolean specialC = true; + boolean jumpC = false; + boolean moveC = false; + boolean dashC = false; + + //hitbox lists + ArrayList ahb = new ArrayList(); + ArrayList athb = new ArrayList(); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); - phb.add(bStandPHB1); - pthb.add(bStandPTHB1); - Frame f = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), - bStandPB1,false,false,false,false,false); - f.setSpriteWrap((138*10),(138*2),138,138); + + //generate hitboxes here and then use ArrayList add method to add them to the correct list + Push_HitBox pB = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f); + Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-250*1.25f,200*1.25f,300*1.25f); + Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-200*1.25f,80*1.25f,50*1.25f); + Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(150*1.25f,-500*1.25f,300*1.25f,70*1.25f); + pthb.add(pthb1); + phb.add(phb1); + phb.add(phb2); + + Frame f = new Frame(moveX,moveY,phb,ahb,pthb,athb,pB,normalC,specialC,jumpC,moveC,dashC); + + f.setSpriteWrap(138*10,138*2,138,138); return f; } @@ -334,20 +474,26 @@ 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(phb2); + phb.add(phb3); + phb.add(phb4); pthb.add(pthb1); /* frame creation */ - Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushB, + Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushb, //cancels (in order : normal, special, jump, move, dash) false,false,false,false,false); f.setSpriteWrap((138*3),0,138,138); @@ -367,20 +513,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(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,-450,250f,220); + Passive_HitBox phb4 = new Passive_HitBox(400,-290,150,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); + Active_HitBox ahb1 = new Active_HitBox(400,-280,220,75); /* adding hitboxes to lists */ phb.add(phb1); + phb.add(phb2); + phb.add(phb3); + phb.add(phb4); pthb.add(pthb1); + ahb.add(ahb1); + /* frame creation */ - Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushB, + Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushb, //cancels (in order : normal, special, jump, move, dash) false,true,false,false,false); f.setSpriteWrap((138*13),0,138,138); @@ -389,35 +543,23 @@ public class BlueNormals { private static Frame standAFrame3(){ - /* - Hitboxes lists creation - */ + 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); + Passive_HitBox bStandPHB3 = new Passive_HitBox(200*1.25f,-400*1.25f,150*1.25f,150*1.25f); + Passive_HitBox bStandPHB4 = new Passive_HitBox(250*1.25f,-150*1.25f,50*1.25f,50*1.25f); + Passive_throw_HitBox bStandPTHB1 = new Passive_throw_HitBox(200*1.25f,-500*1.25f,200*1.25f,70*1.25f); + Push_HitBox bStandPB1 = new Push_HitBox(200*1.25f,-150*1.25f,160*1.25f,400*1.25f); ArrayList phb = new ArrayList(); ArrayList pthb = new ArrayList(); - 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); - - /* - adding hitboxes to lists - */ - phb.add(phb1); - pthb.add(pthb1); - - /* - frame creation - */ - Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pushB, - //cancels (in order : normal, special, jump, move, dash) - false,true,false,false,false); - f.setSpriteWrap((138*14),0,138,138); - return f; + phb.add(bStandPHB1); + phb.add(bStandPHB2); + phb.add(bStandPHB3); + phb.add(bStandPHB4); + pthb.add(bStandPTHB1); + Frame blueStandframe1 = new Frame(0.0,0.0,phb,new ArrayList(),pthb,new ArrayList(), + bStandPB1,false,true,false,false,false); + blueStandframe1.setSpriteWrap(138,0,138,138); + return blueStandframe1; } private static attackPart blueStandAstartup() { diff --git a/src/gameplay/Characters/Blue/BlueSpecials.java b/src/gameplay/Characters/Blue/BlueSpecials.java index f5a0cac..73f6937 100644 --- a/src/gameplay/Characters/Blue/BlueSpecials.java +++ b/src/gameplay/Characters/Blue/BlueSpecials.java @@ -252,5 +252,4 @@ public class BlueSpecials { return new Attack(isSpecial,rS,cmd,parts); } - } diff --git a/src/gameplay/Characters/Blue/CharacterBlue.java b/src/gameplay/Characters/Blue/CharacterBlue.java index 03e6c2e..087b352 100644 --- a/src/gameplay/Characters/Blue/CharacterBlue.java +++ b/src/gameplay/Characters/Blue/CharacterBlue.java @@ -33,6 +33,10 @@ public class CharacterBlue { Attack[] atks = {blueLDP(),blueCrouchFierce(),blueCrouchJab(),blueCrouchShort(),blueStandHeavyKick(),blueStandJab(),blueFordwardRoundHouse()}; + Frame shf = BlueMisc.blueStandHit(); + Frame chf = BlueMisc.blueCrouchHit(); + Frame sbf = BlueMisc.blueStandGuard(); + Frame cbf = BlueMisc.blueCrouchGuard(); /* * Temporary values to change later */ @@ -55,7 +59,7 @@ public class CharacterBlue { - Character c = new Character(0,0,standF[0],1000,atks,fJ,nJ,bJ,fDash,bDash,th,standF,crouchF,fWalkF,bWalkF,f,f,fallingFs,f,f,f,f); + Character c = new Character(0,0,standF[0],1000,atks,fJ,nJ,bJ,fDash,bDash,th,standF,crouchF,fWalkF,bWalkF,f,f,fallingFs,sbf,cbf,shf,chf); return c; } diff --git a/src/gameplay/actions/Attack.java b/src/gameplay/actions/Attack.java index bc17e1a..5558c2e 100644 --- a/src/gameplay/actions/Attack.java +++ b/src/gameplay/actions/Attack.java @@ -48,7 +48,7 @@ public class Attack implements Action { //browse the tab of frames and add it into a list for(int j = 0; j < size; j++) { - res.add(tmp[i]); + res.add(tmp[j]); } } return res; diff --git a/src/gameplay/actions/attackPart.java b/src/gameplay/actions/attackPart.java index ec6db4c..c08d1c5 100644 --- a/src/gameplay/actions/attackPart.java +++ b/src/gameplay/actions/attackPart.java @@ -110,7 +110,11 @@ public class attackPart { } public Frame[] getFrames() { - return frames; + Frame[] f = new Frame[this.frames.length]; + for(int i = 0; i < f.length; i++) { + f[i] = new Frame(); + f[i].clone(this.frames[i]);} + return f; } public void setFrames(Frame[] frames) { diff --git a/src/gameplay/entities/Character.java b/src/gameplay/entities/Character.java index 75a93ae..f6a7e5b 100644 --- a/src/gameplay/entities/Character.java +++ b/src/gameplay/entities/Character.java @@ -6,6 +6,7 @@ import gameplay.frames.nextFrameBuffer; import gameplay.input.InputBuffer; import java.util.ArrayList; +import java.util.Arrays; /** * Character class, which is a sub-class of an entity @@ -206,9 +207,7 @@ public class Character extends Entity { public void setAttackPartsArray(attackPart[] parts) { this.nextAttackParts = new ArrayList(); - for(int i = 0; i < parts.length; i++) { - this.nextAttackParts.add(parts[i]); - } + this.nextAttackParts.addAll(Arrays.asList(parts)); } /** @@ -216,7 +215,7 @@ public class Character extends Entity { * which indicates the character has moved on to the next one */ public void removeFirstAttackPart() { - this.nextAttackParts.remove(0); + if(this.nextAttackParts.size() > 0) {this.nextAttackParts.remove(0);} } public ArrayList getNextThrowParts() { diff --git a/src/gameplay/frames/Frame.java b/src/gameplay/frames/Frame.java index 2a11b0a..7a94eb9 100644 --- a/src/gameplay/frames/Frame.java +++ b/src/gameplay/frames/Frame.java @@ -25,6 +25,7 @@ public class Frame { private boolean moveCancellable; private boolean isDashCancellable; private boolean lastFrameOfHit; + /** * an int of 4 that determines the texture wrap for the frame */ @@ -176,11 +177,9 @@ public class Frame { public void clone(Frame f) { this.setMove_y(f.getMove_y()); this.setMove_x(f.getMove_x()); - this.setPassHitBox(f.getPassHitBox()); - this.setActHitBox(f.getActHitBox()); - this.setPassThrowHitBox(f.getPassThrowHitBox()); - this.setActThrowHitBox(f.getActThrowHitBox()); - this.setPushHitBox(f.getPushHitBox()); + 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; @@ -190,6 +189,25 @@ public class Frame { this.setSpriteWrap(f.sprite[0], f.sprite[1], f.sprite[2], f.sprite[3]); } + private void cloneArray(Frame f){ + for (Passive_HitBox hb : f.getPassHitBox()){ + Passive_HitBox nhb = new Passive_HitBox(hb.getPosX(), hb.getPosY(), hb.getSize_x(), hb.getSize_y()); + this.passHitBox.add(nhb); + } + for (Passive_throw_HitBox hb : f.getPassThrowHitBox()){ + Passive_throw_HitBox nhb = new Passive_throw_HitBox(hb.getPosX(), hb.getPosY(), hb.getSize_x(), hb.getSize_y()); + this.passThrowHitBox.add(nhb); + } + for (Active_HitBox hb : f.getActHitBox()){ + Active_HitBox nhb = new Active_HitBox(hb.getPosX(), hb.getPosY(), hb.getSize_x(), hb.getSize_y()); + this.actHitBox.add(nhb); + } + for (Active_throw_Hitbox hb : f.getActThrowHitBox()){ + Active_throw_Hitbox nhb = new Active_throw_Hitbox(hb.getPosX(), hb.getPosY(), hb.getSize_x(), hb.getSize_y()); + this.actThrowHitBox.add(nhb); + } + } + /** * sets the coordinates on the spritesheet for the texture for that frame * @param x coordinate of the lef tside diff --git a/src/gameplay/hitboxes/HitBox.java b/src/gameplay/hitboxes/HitBox.java index 56515ce..c0e12e4 100644 --- a/src/gameplay/hitboxes/HitBox.java +++ b/src/gameplay/hitboxes/HitBox.java @@ -99,7 +99,7 @@ public class HitBox { } public void reverseHorizontally() { - this.position_x = 138*4 - position_x; + this.position_x = 138*5 - position_x; this.size_x = -this.size_x; } } \ No newline at end of file diff --git a/src/gameplay/match/.gitignore b/src/gameplay/match/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index bd457ca..e4b1a7c 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -78,12 +78,16 @@ public class match { private static HorizontalProgressBar healthBarP1Obj; private static HorizontalProgressBar healthBarP2Obj; private static UIElementText timerUI; + private static UIElementText fpsCounter; private static UIInputList inputListP1; // Debug - private static boolean showP1Hitbox = true; // TODO modifier pour le rendre activable - private static boolean showP2Hitbox = true; + 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; + private static long timeStampFpsCounter; + private static int frameCounter; private static Sprite objP1,objP2; private static Engine engine; @@ -161,7 +165,7 @@ public class match { p1 = CharacterBlue.generateCharBlue(); p2 = CharacterBlue.generateCharBlue(); - objP1 = new Sprite(14f, 4f, path, null); + objP1 = new Sprite(14f, 5f, path, null); objP2 = new Sprite(15f, 5f, path, new Vector3f(1.0f,0.0f,1.0f)); engine.add_objectGl(objP1); engine.add_objectGl(objP2); @@ -206,7 +210,9 @@ public class match { healthBarP1Obj.useTime = true; healthBarP1 = new UIElement(healthBarP1Obj, 0.0138f, 0.980f, engine); healthBarP2Obj = new HorizontalProgressBar(80f, 8.5f, 0.4f, 100f, p2.getCurrentHP(), p2.getMaxHP(), true); - healthBarP2Obj.setColorVerticalGradient(new Vector3f(39f/255f, 201f/255f, 30f/255f), new Vector3f(19f/255f, 89f/255f, 15f/255f)); + healthBarP2Obj.setShader("shaders/StylishShaders/BasicNoTexVert.glsl", "shaders/StylishShaders/HorizontalProgressBarGradientSquareFrag.glsl"); + healthBarP2Obj.setUseHeight(true); + healthBarP2Obj.useTime = true; healthBarP2 = new UIElement(healthBarP2Obj, 0.563f, 0.980f, engine); engine.add_uiElement(healthBarP1); engine.add_uiElement(healthBarP2); @@ -223,6 +229,11 @@ public class match { // Timer timerUI = new UIElementText(timer + "", 10f, 0.453f, 0.995f, 85f, engine); engine.add_uiElement(timerUI); + // FPS counter + fpsCounter = new UIElementText("Boulevard Combattant", 5f, 0f, 0.04f, 100f, engine); + fpsCounter.setBackground(new Vector3f(0f,0f,0f)); + engine.add_uiElement(fpsCounter); + timeStampFpsCounter = System.currentTimeMillis(); //SetTracking engine.setCameraTrackingSF3ThirdStrike(objP1, objP2); @@ -317,6 +328,7 @@ public class match { if(p2.getCurrentframe().islastFrameOfHit()) { p2.removeFirstAttackPart(); } + nextFrame(p1,inputsP1); nextFrame(p2,inputsP2); @@ -324,7 +336,6 @@ public class match { updatePos(p1,p1LooksRight); updatePos(p2,!p1LooksRight); - if(p1LooksRight) { f = p1.getCurrentframe(); @@ -333,7 +344,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 +352,6 @@ public class match { p2.setCurrentFrame(nf); objP2.flipTextureWrapH(); - } else { Frame p1f = p1.getCurrentframe(); @@ -359,6 +369,7 @@ public class match { objP1.flipTextureWrapH(); } + // Debug Hitbox Management removeHitboxEngine(); if (showP1Hitbox){ @@ -387,9 +398,17 @@ public class match { timer = 99 - frameCount/60; timeStamp2 = System.currentTimeMillis(); - while(timeStamp2-timeStamp1<(1000/60)) { + while(timeStamp2-timeStamp1<(1000/(60 * slowFactor))) { timeStamp2 = System.currentTimeMillis(); } + + frameCounter++; + if (System.currentTimeMillis() - timeStampFpsCounter >= 1000){ + fpsCounter.setText("FPS: " + frameCounter); + frameCounter = 0; + timeStampFpsCounter = System.currentTimeMillis(); + } + frameCount++; timeStamp1 = System.currentTimeMillis(); acCode=10; @@ -623,7 +642,10 @@ public class match { c.setStatus(Status.NORMAL); if(in.getLatestInputs().containsInput(ButtonIG.DOWN)) { c.addNextFrames(c.getDefaultCrouchingFrames()); - } else {c.addNextFrames(c.getDefaultStandingFrames());} + } + else { + c.addNextFrames(c.getDefaultStandingFrames()); + } break; } } @@ -634,7 +656,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 +681,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; } } diff --git a/textures/Sprite_9comp.png b/textures/Sprite_9comp.png index 69ced82..063fabe 100644 Binary files a/textures/Sprite_9comp.png and b/textures/Sprite_9comp.png differ diff --git a/textures/Sprite_sans_grille_9comp.png b/textures/Sprite_sans_grille_9comp.png index d413f70..0350b11 100644 Binary files a/textures/Sprite_sans_grille_9comp.png and b/textures/Sprite_sans_grille_9comp.png differ diff --git a/textures/sprite_action.txt b/textures/sprite_action.txt index 82ba20f..7f22390 100644 --- a/textures/sprite_action.txt +++ b/textures/sprite_action.txt @@ -31,17 +31,15 @@ 31-victory 1 32-stunned 33-knockdown/recover +34-tatsumaki senpuu kyaku +35-victory 2 +36-crouch m kick +37-crouch h kick +38-forward jump m h kick +39-mugshots +40-shoulder toss (32) +41-backroll manquant: - -crouch m kick (21) -crouch h kick (22) -forward jump m h kick (27) -tatsumaki senpuu kyaku (29) -shoulder toss (32) -backroll(33) - -victory 2 (39) time over (40) alternate palettes(41) -mugshots(42) \ No newline at end of file