From 15024bd4975f386c6441b2956323b048eccd2969 Mon Sep 17 00:00:00 2001 From: no Date: Sun, 20 Jun 2021 16:25:49 +0200 Subject: [PATCH] Corrected a bug that often made the wrong frame display. --- .../Characters/Blue/BlueBaseFrames.java | 2 +- src/gameplay/Characters/Blue/BlueNormals.java | 150 ++++++++++++++---- src/gameplay/actions/Attack.java | 2 +- src/gameplay/actions/attackPart.java | 6 +- 4 files changed, 122 insertions(+), 38 deletions(-) diff --git a/src/gameplay/Characters/Blue/BlueBaseFrames.java b/src/gameplay/Characters/Blue/BlueBaseFrames.java index 3e33bd9..83762db 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 = BlueNormals.blueCrouchJab().getFrame().get(0); + Frame f = BlueNormals.blueCrouchFierce().getFrame().get(22); 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 2d33602..f136378 100644 --- a/src/gameplay/Characters/Blue/BlueNormals.java +++ b/src/gameplay/Characters/Blue/BlueNormals.java @@ -51,31 +51,73 @@ public class BlueNormals { } 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() { @@ -114,30 +156,68 @@ 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; } 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) {