From e645f66dc836091d8d2d0359defd38add33bf4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Wed, 23 Jun 2021 16:52:00 +0200 Subject: [PATCH 1/7] Added stage selection capabilities --- src/gameplay/match/match.java | 41 ++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/src/gameplay/match/match.java b/src/gameplay/match/match.java index 3a5d3d3..da0d8f8 100644 --- a/src/gameplay/match/match.java +++ b/src/gameplay/match/match.java @@ -177,18 +177,47 @@ public class match { boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1); boolean Joystick2Present = glfwJoystickPresent(GLFW_JOYSTICK_2); - String path = "textures/Sprite_sans_grille_9comp.png"; - String pathToBG = "textures/arena1.png"; + String pathToBG = ""; + switch (stage) { + case "arena1": + pathToBG = "textures/arena1.png"; + break; + default: + pathToBG = "textures/arena1.png"; + } ObjectGl background = new ObjectGl(0f,1f,1f,2.5f, pathToBG, null); background.setTextureWrap(0, 0, 1914f, 701f); background.translate(new Vector3f(-1350f, 1000f, 0f)); engine.add_objectGl(background); - p1 = CharacterBlue.generateCharBlue(); - p2 = CharacterBlue.generateCharBlue(); - objP1 = new Sprite(14f, 5f, path, null); - objP2 = new Sprite(15f, 5f, path, new Vector3f(1.0f,0.0f,1.0f)); + String pathp1 = ""; + String pathp2 = ""; + + switch (character1) { + case "blue": + p1 = CharacterBlue.generateCharBlue(); + pathp1 = "textures/Sprite_sans_grille_9comp.png"; + break; + default: + p1 = CharacterBlue.generateCharBlue(); + pathp1 = "textures/Sprite_sans_grille_9comp.png"; + break; + } + + switch (character2) { + case "blue": + p2 = CharacterBlue.generateCharBlue(); + pathp2 = "textures/Sprite_sans_grille_9comp.png"; + break; + default: + p2 = CharacterBlue.generateCharBlue(); + pathp2 = "textures/Sprite_sans_grille_9comp.png"; + break; + } + + objP1 = new Sprite(14f, 5f, pathp1, null); + objP2 = new Sprite(15f, 5f, pathp2, new Vector3f(1.0f,0.0f,1.0f)); engine.add_objectGl(objP1); engine.add_objectGl(objP2); From 375230466d628d004e5b326552fb617fde44996e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rativel?= Date: Wed, 23 Jun 2021 17:07:33 +0200 Subject: [PATCH 2/7] Implemented functions for knockedDown in BlueBaseFrames --- .../Characters/Blue/BlueBaseFrames.java | 261 ++++++++++++++++++ .../Characters/Blue/CharacterBlue.java | 6 +- 2 files changed, 265 insertions(+), 2 deletions(-) diff --git a/src/gameplay/Characters/Blue/BlueBaseFrames.java b/src/gameplay/Characters/Blue/BlueBaseFrames.java index f0476a7..a7c4986 100644 --- a/src/gameplay/Characters/Blue/BlueBaseFrames.java +++ b/src/gameplay/Characters/Blue/BlueBaseFrames.java @@ -745,7 +745,268 @@ public class BlueBaseFrames { f[3] = walkBackFrame4(); return f; } + + private static Frame KnockedDown1() { + //movement data + double moveX = -6.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(200,-150,160,400); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap(0,(138*6),138,138); + return f; + } + + private static Frame KnockedDown2() { + //movement data + double moveX = -6.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(200,-150,160,400); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap(138,(138*6),138,138); + return f; + } + + private static Frame KnockedDown3() { + //movement data + double moveX = -6.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(200,-150,160,400); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap((138*2),(138*6),138,138); + return f; + } + + private static Frame KnockedDown4() { + //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(200,-150,160,400); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap((138*3),(138*6),138,138); + return f; + } + + private static Frame KnockedDown5() { + //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(200,-150,160,400); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap((138*4),(138*6),138,138); + return f; + } + + private static Frame KnockedDown6() { + //movement data + double moveX = -6.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(200,-150,160,400); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap((138*5),(138*6),138,138); + return f; + } + + private static Frame KnockedDown7() { + //movement data + double moveX = -6.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(200,-150,160,400); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap((138*6),(138*6),138,138); + return f; + } + + private static Frame KnockedDown8() { + //movement data + double moveX = -6.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(200,-150,160,400); + + Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC); + + //set sprite data on sheet + f.setSpriteWrap((138*7),(138*6),138,138); + return f; + } + + protected static Frame[] knockedDown() { + Frame[] f = new Frame[50]; + int i=0; + while(i < 5) { + f[i] = KnockedDown1(); + i++; + } + while(i < 10) { + f[i] = KnockedDown2(); + i++; + } + while(i < 15) { + f[i] = KnockedDown3(); + i++; + } + while(i < 30) { + f[i] = KnockedDown4(); + i++; + } + while(i < 35) { + f[i] = KnockedDown5(); + i++; + } + while(i < 40) { + f[i] = KnockedDown6(); + i++; + } + while(i < 45) { + f[i] = KnockedDown7(); + i++; + } + while(i < f.length) { + f[i] = KnockedDown8(); + i++; + } + return f; + } public static void main(String[] args) { Engine engine = new Engine(640, 480, new Vector3f(4.0f, 3.0f)); diff --git a/src/gameplay/Characters/Blue/CharacterBlue.java b/src/gameplay/Characters/Blue/CharacterBlue.java index 2e29df3..c88c5c4 100644 --- a/src/gameplay/Characters/Blue/CharacterBlue.java +++ b/src/gameplay/Characters/Blue/CharacterBlue.java @@ -57,12 +57,14 @@ public class CharacterBlue { Dash bDash =new Dash(bdashCMD,bDashF); Frame[] fallingFs = new Frame[0]; - + + Frame[] knDwn = BlueBaseFrames.knockedDown(); + Frame f = new Frame(); - 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); + Character c = new Character(0,0,standF[0],1000,atks,fJ,nJ,bJ,fDash,bDash,th,standF,crouchF,fWalkF,bWalkF,f,f,knDwn,sbf,cbf,shf,chf); return c; } From e36955d948e221996584b13d7284924f94a9fdf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Wed, 23 Jun 2021 17:14:57 +0200 Subject: [PATCH 3/7] partially improved launcher functionnality --- src/launcher/Config.java | 23 +++++++++++------------ src/launcher/Launcher.java | 23 ++++++++++++++++++++++- src/launcher/Settings.java | 13 +++++++++++-- src/launcher/launcher.fxml | 8 ++++++++ 4 files changed, 52 insertions(+), 15 deletions(-) diff --git a/src/launcher/Config.java b/src/launcher/Config.java index 055e5b8..c1f4517 100644 --- a/src/launcher/Config.java +++ b/src/launcher/Config.java @@ -7,7 +7,7 @@ import org.json.simple.parser.*; public class Config { public int width, height, rounds; - public boolean fullscreen; + public boolean fullscreen, hitboxes; public String stage; public String p1, p2; @@ -37,9 +37,8 @@ public class Config { // print a case of this element stage = (String) settings.get("stage"); - // nb players selection - /* JSONArray nb_players = (JSONArray) jsonO.get("nb_players"); - System.out.println("nb_player : " + nb_players.get(1)); */ + // rounds + rounds = Integer.parseInt((String) settings.get("rounds")); // character selection p1 = (String) settings.get("character1"); @@ -54,6 +53,12 @@ public class Config { fullscreen = true; } else fullscreen = false; + String hb = (String) settings.get("hitboxes"); + if (hb == null) hb = "false"; + if (hb.equals("true")) { + hitboxes = true; + } else hitboxes = false; + // rounds String temprounds = (String) settings.get("rounds"); switch (temprounds) { @@ -63,13 +68,6 @@ public class Config { default: rounds = 1; } - // button selection - /* JSONArray allButton = (JSONArray) jsonO.get("button"); - System.out.println(allButton); - - String up = (String) allButton.get(0); - System.out.println("button for up is : " + up); */ - } catch (FileNotFoundException e) { File f = new File("game.set"); try { @@ -88,7 +86,7 @@ public class Config { } @SuppressWarnings("unchecked") - public void write(int width, int height, int rounds, boolean fullscreen, String character1, String character2, String stage) throws Exception { + public void write(int width, int height, int rounds, boolean fullscreen, boolean hitboxes, String character1, String character2, String stage) throws Exception { JSONObject metafile = new JSONObject(); JSONArray array = new JSONArray(); @@ -98,6 +96,7 @@ public class Config { set.put("height", Integer.toString(height)); set.put("rounds", Integer.toString(rounds)); set.put("fullscreen", Boolean.toString(fullscreen)); + set.put("hitboxes", Boolean.toString(hitboxes)); set.put("character1", character1); set.put("character2", character2); set.put("stage", stage); diff --git a/src/launcher/Launcher.java b/src/launcher/Launcher.java index 7c10e50..947f61e 100644 --- a/src/launcher/Launcher.java +++ b/src/launcher/Launcher.java @@ -75,6 +75,22 @@ public class Launcher extends Application { fs.setSelected(false); } + ChoiceBox cbr = (ChoiceBox) namespace.get("rounds"); + ObservableList nbrounds = FXCollections.observableArrayList("1", "3", "5", "7", "9"); + cbr.setItems(nbrounds); + if (!nbrounds.contains(setter.getRounds())) { + cb.setValue("3"); + } else { + cb.setValue(setter.getRounds()); + } + + CheckBox hb = (CheckBox) namespace.get("hitboxes"); + if (setter.getHitboxes()) { + hb.setSelected(true); + } else { + hb.setSelected(false); + } + VBox v1 = (VBox) namespace.get("p1"); ChoiceBox b1 = (ChoiceBox) v1.getChildren().get(1); VBox v2 = (VBox) namespace.get("p2"); @@ -139,9 +155,14 @@ public class Launcher extends Application { } pointer.arraysettings.put("width", width); pointer.arraysettings.put("height", height); + CheckBox fs = (CheckBox) namespace.get("fullscreen"); pointer.arraysettings.put("fullscreen", fs.isSelected()); - pointer.arraysettings.put("rounds", 3); + CheckBox hb = (CheckBox) namespace.get("hitboxes"); + pointer.arraysettings.put("hitboxes", hb.isSelected()); + + ChoiceBox rnd = (ChoiceBox) namespace.get("rounds"); + pointer.arraysettings.put("rounds", rnd.getValue()); VBox vp1 = (VBox) namespace.get("p1"); ChoiceBox p1 = (ChoiceBox) vp1.getChildren().get(1); diff --git a/src/launcher/Settings.java b/src/launcher/Settings.java index 8c706d7..51ca2b8 100644 --- a/src/launcher/Settings.java +++ b/src/launcher/Settings.java @@ -22,12 +22,13 @@ public class Settings { int height = (Integer) set.get("height"); int rounds = (Integer) set.get("rounds"); boolean fullscreen = (Boolean) set.get("fullscreen"); + boolean hitboxes = (Boolean) set.get("hitboxes"); String character1 = (String) set.get("character1"); String character2 = (String) set.get("character2"); String stage = (String) set.get("stage"); - config.write(width, height, rounds, fullscreen, character1, character2, stage); + config.write(width, height, rounds, fullscreen, hitboxes, character1, character2, stage); } catch (Exception e) { - config.write(800, 600, 3, false, "blue", "blue", "default"); + config.write(800, 600, 3, false, false, "blue", "blue", "default"); System.out.println("Incorrect config file"); } } @@ -40,6 +41,14 @@ public class Settings { return config.fullscreen; } + public boolean getHitboxes() { + return config.hitboxes; + } + + public String getRounds() { + return Integer.toString(config.rounds); + } + public String getChar1() { return config.p1; } diff --git a/src/launcher/launcher.fxml b/src/launcher/launcher.fxml index afd9403..c8a3caa 100644 --- a/src/launcher/launcher.fxml +++ b/src/launcher/launcher.fxml @@ -42,6 +42,14 @@ +