Reorganized project to fit Maven's directory structure.
19
src/main/java/Main.java
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* CLASS MAIN
|
||||
*
|
||||
* PROJET DE FIN D'ANNÉE DE L3
|
||||
*
|
||||
* @author François Autin
|
||||
*
|
||||
*/
|
||||
|
||||
import launcher.Launcher;
|
||||
import javafx.application.Application;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Application.launch(Launcher.class, args);
|
||||
}
|
||||
|
||||
}
|
313
src/main/java/engine/Engine.java
Normal file
@ -0,0 +1,313 @@
|
||||
package engine;
|
||||
|
||||
import engine.camera.*;
|
||||
import engine.gui.UIDummy;
|
||||
import engine.input.*;
|
||||
import engine.math.*;
|
||||
import engine.object.*;
|
||||
|
||||
import org.lwjgl.glfw.GLFWFramebufferSizeCallback;
|
||||
import org.lwjgl.glfw.GLFWVidMode;
|
||||
import org.lwjgl.opengl.GL;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||
|
||||
public class Engine {
|
||||
|
||||
private static long window;
|
||||
|
||||
private final List<ObjectGl> objectsGl;
|
||||
public final List<UIDummy> uiElements;
|
||||
|
||||
private boolean running;
|
||||
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final boolean fullscreen;
|
||||
|
||||
private float viewXPos;
|
||||
private float viewYPos;
|
||||
private Vector3f transformationView;
|
||||
private final Camera camera;
|
||||
|
||||
private TrackingDummy tracking;
|
||||
|
||||
/*
|
||||
Init Method
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create the engine and initial attributes use .init() to start the engine
|
||||
* Initial projection is -1000;1000 in width and -1000*aspectRatio; 1000*aspectRatio
|
||||
* Initial Camera position is (0, 0, -1) //TODO vérifiez
|
||||
*/
|
||||
public Engine(int width, int height, boolean fullscreen, Vector3f aspectRatio) {
|
||||
this.running = false;
|
||||
this.objectsGl = new ArrayList<>();
|
||||
this.uiElements = new ArrayList<>();
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.viewXPos = 0.0f;
|
||||
this.viewYPos = 0.0f;
|
||||
this.camera = new Camera(1000, aspectRatio, this);
|
||||
ObjectGl.view = Matrix4f.translate(new Vector3f(0.0f, 0.0f, 1.0f));
|
||||
this.transformationView = new Vector3f();
|
||||
this.tracking = null;
|
||||
this.fullscreen = fullscreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the engine
|
||||
* Create the window
|
||||
* Set the color of the background
|
||||
*/
|
||||
public void init() {
|
||||
if (!glfwInit()){
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
this.running = true;
|
||||
|
||||
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); //On utilise la version 3.3 d'openGL
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); //Compatible MAC
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //Le core profile est l'interface 'avancé' d'openGL
|
||||
|
||||
int width = this.width;
|
||||
int height = this.height;
|
||||
if (fullscreen) {
|
||||
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", glfwGetPrimaryMonitor(), NULL));
|
||||
} else {
|
||||
this.setWindow(glfwCreateWindow(width, height, "Boulevard Combattant", NULL, NULL));
|
||||
}
|
||||
assert getWindow() != NULL;
|
||||
|
||||
// On récupère les informations du moniteur principal
|
||||
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
||||
assert vidmode != null;
|
||||
|
||||
// On met la fenêtre au centre de l'écran principale
|
||||
glfwSetWindowPos(getWindow(), (vidmode.width() - width) / 2, (vidmode.height() - height) / 2);
|
||||
|
||||
glfwSetKeyCallback(getWindow(), new KeyboardInput());
|
||||
glfwSetInputMode(getWindow(), GLFW_STICKY_KEYS, GLFW_TRUE);
|
||||
|
||||
// Contexte = zone cible des rendus
|
||||
glfwMakeContextCurrent(getWindow());
|
||||
glfwShowWindow(getWindow());
|
||||
GL.createCapabilities();
|
||||
|
||||
correctViewport(this.width, this.height);
|
||||
|
||||
glfwSetFramebufferSizeCallback(getWindow(), resizeWindow);
|
||||
|
||||
glEnable(GL_DEPTH_TEST); // Z-Buffer plus z est grand plus l'objet est proche de la camera limite à 100.0f au dela l'objet disparait
|
||||
|
||||
glEnable(GL_BLEND); // Transparence
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
System.out.println("OpenGL: " + glGetString(GL_VERSION));
|
||||
}
|
||||
|
||||
/*
|
||||
RENDER / UPDATE
|
||||
*/
|
||||
|
||||
public void render() {
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
objectsGl.sort(new SortZ());
|
||||
for (ObjectGl objectGl : objectsGl) {
|
||||
objectGl.render();
|
||||
}
|
||||
|
||||
int error = glGetError();
|
||||
if (error != GL_NO_ERROR) System.out.println(error);
|
||||
glfwSwapBuffers(getWindow()); //Envoie le buffer vers le moniteur
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void update() {
|
||||
glfwPollEvents();
|
||||
// METS A JOUR LA POSITION DES ELEMENTS D'INTERFACE
|
||||
for (UIDummy uiElement : this.uiElements){
|
||||
uiElement.update();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Window / Viewport Management
|
||||
*/
|
||||
|
||||
public static void correctViewport(int width, int height){
|
||||
int heightViewport, widthViewport, x, y;
|
||||
if (width >= height * 4.0f/3.0f){
|
||||
heightViewport = height;
|
||||
widthViewport = (int) (height * 4.0f/3.0f);
|
||||
y = 0;
|
||||
x = (width - widthViewport)/2;
|
||||
} else {
|
||||
widthViewport = width;
|
||||
heightViewport = (int) (width * 3.0f/4.0f);
|
||||
y = (height - heightViewport)/2;
|
||||
x = 0;
|
||||
}
|
||||
glScissor(x, y, widthViewport, heightViewport);
|
||||
glViewport(x, y, widthViewport, heightViewport);
|
||||
}
|
||||
|
||||
public boolean shouldClose() {
|
||||
return glfwWindowShouldClose(getWindow());
|
||||
}
|
||||
|
||||
/*
|
||||
ObjectGl Management
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add obj to the render queue
|
||||
* @param obj ObjectGl to render
|
||||
*/
|
||||
public void add_objectGl(ObjectGl obj) {
|
||||
this.objectsGl.add(obj);
|
||||
}
|
||||
|
||||
public void add_objectsGl(List<ObjectGl> objs) {
|
||||
this.objectsGl.addAll(objs);
|
||||
}
|
||||
|
||||
public void remove_objectGl(ObjectGl obj) {
|
||||
obj.delete();
|
||||
this.objectsGl.remove(obj);
|
||||
}
|
||||
|
||||
public void remove_objectsGl(List<ObjectGl> obj) {
|
||||
this.objectsGl.removeAll(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
UIElement Management
|
||||
*/
|
||||
|
||||
public void add_uiElement(UIDummy uiElement) {
|
||||
uiElement.init();
|
||||
this.uiElements.add(uiElement);
|
||||
}
|
||||
|
||||
public void remove_uiElement(UIDummy uiElement) {
|
||||
this.uiElements.remove(uiElement);
|
||||
uiElement.delete();
|
||||
}
|
||||
|
||||
public void setUIElementZoomFactor(float scaleFactor){
|
||||
for (UIDummy uiElement : this.uiElements){
|
||||
uiElement.updateScalingFactor(scaleFactor);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CAMERA
|
||||
*/
|
||||
|
||||
public void translateView(Vector3f vec){
|
||||
ObjectGl.view = ObjectGl.view.multiply(Matrix4f.translate(vec));
|
||||
viewXPos += vec.x;
|
||||
this.transformationView = this.transformationView.addXYZ(vec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate la camera pour avoir obj au centre de l'image, comme le cadrage se fait sur le point en haut à gauche
|
||||
* de l'objet un offset peut parfois être nécessaire
|
||||
* @param obj l'objectGl que la camera va suivre
|
||||
* @param xOffset un offSet sur l'axe X
|
||||
*/
|
||||
public void cameraTrackingObjectGl(ObjectGl obj, float xOffset){
|
||||
Vector3f trackingVector = new Vector3f((- obj.getXPos() - this.viewXPos) + xOffset,0.0f ,0.0f);
|
||||
this.translateView(trackingVector);
|
||||
}
|
||||
|
||||
public void setCameraTrackingBetweenTwoObjectGl(ObjectGl obj1, ObjectGl obj2, float deadZone){
|
||||
// obj2 est considéré à droite probablement à modifier
|
||||
this.tracking = new TrackingTore(
|
||||
deadZone,
|
||||
obj1,
|
||||
obj2,
|
||||
this);
|
||||
}
|
||||
|
||||
public void setCameraTrackingSF3ThirdStrike(ObjectGl obj1, ObjectGl obj2){
|
||||
this.tracking = new TrackingSF3ThirdStrick(obj1, obj2, this);
|
||||
}
|
||||
|
||||
public void cameraTracking(){
|
||||
if (this.tracking == null) System.out.println("Define a tracking first");
|
||||
else {
|
||||
Vector3f trackingVector = this.tracking.getViewVector();
|
||||
this.translateView(trackingVector);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CALLBACK
|
||||
*/
|
||||
|
||||
/**
|
||||
* Est appelé à chaque modification de la taille de la fenêtre, et modifie la taille de la zone de rendu
|
||||
* pour quelle corresponde à la taille de la fenêtre
|
||||
*/
|
||||
private static final GLFWFramebufferSizeCallback resizeWindow = new GLFWFramebufferSizeCallback() {
|
||||
@Override
|
||||
public void invoke(long window, int width, int height) {
|
||||
correctViewport(width, height);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
GET/SET
|
||||
*/
|
||||
|
||||
public boolean getRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
public void setRunning(boolean b) {
|
||||
running = b;
|
||||
}
|
||||
|
||||
public float getViewXPos(){
|
||||
return viewXPos;
|
||||
}
|
||||
|
||||
public float getViewYPos(){
|
||||
return viewYPos;
|
||||
}
|
||||
|
||||
public Vector3f getTransformationView() {
|
||||
return transformationView;
|
||||
}
|
||||
|
||||
public Camera getCamera(){
|
||||
return this.camera;
|
||||
}
|
||||
|
||||
public static long getWindow() {
|
||||
return window;
|
||||
}
|
||||
|
||||
public void setWindow(long window) {
|
||||
Engine.window = window;
|
||||
}
|
||||
|
||||
}
|
186
src/main/java/engine/TestEngine.java
Normal file
@ -0,0 +1,186 @@
|
||||
package engine;
|
||||
|
||||
import engine.gui.UIElement;
|
||||
import engine.gui.UIElementText;
|
||||
import engine.input.*;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.ObjectGl;
|
||||
import engine.object.HorizontalProgressBar;
|
||||
import engine.object.Sprite;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
public class TestEngine {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
/*
|
||||
OpenAl TEST
|
||||
*/
|
||||
/*SoundManager soundManager = new SoundManager();
|
||||
soundManager.init();
|
||||
|
||||
SoundListener soundListener = new SoundListener();
|
||||
|
||||
soundManager.setListener(soundListener);
|
||||
|
||||
SoundBuffer jumpSoundBuffer = new SoundBuffer("sound/jump.ogg");
|
||||
SoundSource soundSource = new SoundSource(false, false);
|
||||
soundSource.setBuffer(jumpSoundBuffer.getBufferId());
|
||||
|
||||
soundManager.addSoundSource("jump", soundSource);
|
||||
// soundManager.playSoundSource("jump");*/
|
||||
|
||||
/*
|
||||
Engine Init
|
||||
*/
|
||||
Engine engine = new Engine(1280, 720, false, new Vector3f(4.0f, 3.0f));
|
||||
int speed = 10; //vitesse d<>placement Object
|
||||
engine.init();
|
||||
|
||||
// Add objects to render
|
||||
String path = "textures/zangief_sprite.png";
|
||||
String path2 = "textures/awesomeface.png";
|
||||
String pathToBG = "textures/background_beach.png";
|
||||
String pathToText = "textures/dejavu10x10_gs_tc.png";
|
||||
|
||||
ObjectGl zangief = new Sprite(10.0f, 10f, path, null);
|
||||
zangief.setTextureWrap(58, 0, 62, 84);
|
||||
engine.add_objectGl(zangief);
|
||||
zangief.translate(new Vector3f(-750.0f, 200.0f, 0.0f));
|
||||
zangief.setColor(new Vector3f(1.0f, 1.0f, 1.0f));
|
||||
zangief.setShader("shaders/StylishShaders/BasicVert.glsl", "shaders/StylishShaders/FlashFrag.glsl");
|
||||
zangief.useTime = true;
|
||||
|
||||
ObjectGl zangief2 = new Sprite(9.0f, 10f, path, null);
|
||||
zangief2.setTextureWrap(58, 0, 62, 84);
|
||||
engine.add_objectGl(zangief2);
|
||||
zangief2.translate(new Vector3f(500.0f, 200.0f, 0.0f));
|
||||
zangief2.flipTextureWrapH();
|
||||
|
||||
ObjectGl shaderTestSubject = new ObjectGl(24f, 10f, 10f, 100f, null, null);
|
||||
shaderTestSubject.translate(new Vector3f(-200f, 400f, 0f));
|
||||
engine.add_objectGl(shaderTestSubject);
|
||||
|
||||
// Hitbox hitboxTest = new Hitbox(35.0f, 100.0f, 50.0f, 10.0f, new Vector3f(1.0f, 0.0f, 0.0f));
|
||||
// engine.add_objectGl(hitboxTest);
|
||||
|
||||
engine.setCameraTrackingSF3ThirdStrike(zangief, zangief2);
|
||||
|
||||
//Create background
|
||||
ObjectGl background = new ObjectGl(0f,1f,1f,10f, pathToBG, null);
|
||||
background.setTextureWrap(0,0,621, 224);
|
||||
background.translate(new Vector3f(-3011.0f, 1400.0f, 1.0f));
|
||||
engine.add_objectGl(background);
|
||||
|
||||
// ObjectGl smiley = new Sprite(15.0f, 500.0f, path2, null);
|
||||
// UIElement uiElement = new UIElement(smiley, 0.0f, 1.0f, engine);
|
||||
// engine.add_uiElement(uiElement);
|
||||
|
||||
UIElementText fpsTracker = new UIElementText("Boulevard Combattant", 5.0f, 0.0f,0.5f, 25.0f, engine);
|
||||
engine.add_uiElement(fpsTracker);
|
||||
fpsTracker.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true);
|
||||
|
||||
UIElementText uiTextCoordP1 = new UIElementText("Boulevard Combattant", 7.0f, 0.0f,0.05f, 25.0f, engine);
|
||||
engine.add_uiElement(uiTextCoordP1);
|
||||
|
||||
HorizontalProgressBar healthP1 = new HorizontalProgressBar(50f, 9, 1, 100, 100, 100, true);
|
||||
UIElement healthP1UI = new UIElement(healthP1, 0.005f, 0.995f, engine);
|
||||
engine.add_uiElement(healthP1UI);
|
||||
float hpCurrent = 100;
|
||||
|
||||
// Text texTest = new Text("ABCDEFGHIJKLMNOPQRSTUVWYZ",20.0f, 10, engine);
|
||||
// texTest.show();
|
||||
// texTest.translate(new Vector3f(-1000.0f, (float) (-1000.0f * (3.0 / 4.0f) + 100.0f)));
|
||||
|
||||
long timer = System.currentTimeMillis();
|
||||
long lastFrame;
|
||||
int frame = 0;
|
||||
boolean nextFrame = false;
|
||||
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||
|
||||
/*
|
||||
* Cr<43>ation des manettes / action
|
||||
*/
|
||||
|
||||
GamepadInput gamepad1 = null;
|
||||
Button zoom = null;
|
||||
Button dezoom = null;
|
||||
|
||||
if (Joystick1Present){
|
||||
gamepad1 = new GamepadInput(GLFW_JOYSTICK_1);
|
||||
gamepad1.inputRefresh();
|
||||
}
|
||||
|
||||
List<Integer> listZoomPlus = new ArrayList<>();
|
||||
listZoomPlus.add(InputConst.buttonA);
|
||||
List<Integer> listZoomMinusKeyboard = new ArrayList<>();
|
||||
listZoomMinusKeyboard.add(GLFW_KEY_R);
|
||||
List<Integer> listZoomMinus = new ArrayList<>();
|
||||
listZoomMinus.add(InputConst.buttonB);
|
||||
List<Integer> listZoomPlusKeyboard = new ArrayList<>();
|
||||
listZoomPlusKeyboard.add(GLFW_KEY_F);
|
||||
zoom = new Button("zoom", listZoomPlus, listZoomPlusKeyboard, gamepad1);
|
||||
dezoom = new Button("dezoom", listZoomMinus, listZoomMinusKeyboard, gamepad1);
|
||||
engine.translateView(new Vector3f(0.0f, -125.0f, 0.0f));
|
||||
|
||||
while (engine.getRunning()) {
|
||||
lastFrame = System.currentTimeMillis();
|
||||
// Game logic should fit here
|
||||
|
||||
if (Joystick1Present) {
|
||||
gamepad1.inputRefresh();
|
||||
}
|
||||
// Check si le personnage a sauté
|
||||
if (zoom.isButtonPressed()){
|
||||
// Le personnage saute
|
||||
engine.getCamera().zoom(1.001f);
|
||||
}if(dezoom.isButtonPressed()){
|
||||
engine.getCamera().zoom(0.999f);
|
||||
}
|
||||
|
||||
// engine.cameraTrackingObjectGl(zangief, -250.0f);
|
||||
engine.cameraTracking();
|
||||
|
||||
uiTextCoordP1.setText("X: " + zangief.getXPos() + " Y: " + zangief.getYPos());
|
||||
|
||||
KeyboardInput.keyboardInput(zangief, speed);
|
||||
|
||||
/*
|
||||
********************
|
||||
* essential part v *
|
||||
********************
|
||||
*/
|
||||
engine.update();
|
||||
engine.render();
|
||||
|
||||
frame++;
|
||||
|
||||
if (System.currentTimeMillis() - timer > 1000) {
|
||||
timer += 1000;
|
||||
System.out.println("FPS: " + frame);
|
||||
fpsTracker.setText("FPS: " + frame);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
// while (!nextFrame) {
|
||||
// nextFrame = System.currentTimeMillis() - lastFrame >= 16.66f;
|
||||
// }
|
||||
|
||||
hpCurrent -= 0.1;
|
||||
healthP1.setCurrent(hpCurrent);
|
||||
if (hpCurrent < 0){
|
||||
hpCurrent = 100f;
|
||||
}
|
||||
|
||||
nextFrame = false;
|
||||
if (engine.shouldClose()) engine.setRunning(false);
|
||||
}
|
||||
|
||||
//soundManager.cleanup();
|
||||
|
||||
}
|
||||
|
||||
}
|
37
src/main/java/engine/camera/Camera.java
Normal file
@ -0,0 +1,37 @@
|
||||
package engine.camera;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Matrix4f;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.ObjectGl;
|
||||
|
||||
public class Camera {
|
||||
|
||||
private float dimension;
|
||||
private final Vector3f aspectRatio;
|
||||
private final Engine engine;
|
||||
|
||||
|
||||
public Camera(float dimension, Vector3f aspectRatio, Engine engine){
|
||||
this.dimension = dimension;
|
||||
this.aspectRatio = aspectRatio;
|
||||
this.engine = engine;
|
||||
float ar = aspectRatio.y / aspectRatio.x;
|
||||
ObjectGl.projection = Matrix4f.orthographic(-dimension, dimension, -dimension * ar, dimension * ar, 0.1f, 1000.0f);
|
||||
}
|
||||
|
||||
public void zoom(float zoomFactor){
|
||||
engine.setUIElementZoomFactor(zoomFactor);
|
||||
this.dimension *= zoomFactor;
|
||||
float ar = aspectRatio.y / aspectRatio.x;
|
||||
ObjectGl.projection = Matrix4f.orthographic(-dimension, dimension, -dimension * ar, dimension * ar, 0.1f, 100.0f);
|
||||
}
|
||||
|
||||
public float getDimension(){
|
||||
return this.dimension;
|
||||
}
|
||||
|
||||
public Vector3f getAspectRatio(){
|
||||
return this.aspectRatio;
|
||||
}
|
||||
}
|
9
src/main/java/engine/camera/TrackingDummy.java
Normal file
@ -0,0 +1,9 @@
|
||||
package engine.camera;
|
||||
|
||||
import engine.math.Vector3f;
|
||||
|
||||
public interface TrackingDummy {
|
||||
|
||||
Vector3f getViewVector();
|
||||
|
||||
}
|
40
src/main/java/engine/camera/TrackingSF3ThirdStrick.java
Normal file
@ -0,0 +1,40 @@
|
||||
package engine.camera;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.ObjectGl;
|
||||
|
||||
public class TrackingSF3ThirdStrick implements TrackingDummy {
|
||||
|
||||
private final ObjectGl obj1;
|
||||
private final ObjectGl obj2;
|
||||
private final Engine engine;
|
||||
|
||||
/**
|
||||
* Un tracking ou les personnages "pousse" la camera
|
||||
*/
|
||||
public TrackingSF3ThirdStrick(ObjectGl obj1, ObjectGl obj2, Engine engine){
|
||||
this.obj1 = obj1;
|
||||
this.obj2 = obj2;
|
||||
this.engine = engine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3f getViewVector() {
|
||||
Vector3f vec = new Vector3f();
|
||||
|
||||
float viewXPos = -this.engine.getViewXPos();
|
||||
float dimension = this.engine.getCamera().getDimension();
|
||||
|
||||
ObjectGl left = obj1.getXPos() >= obj2.getXPos() ? obj2 : obj1;
|
||||
ObjectGl right = obj1.getXPos() < obj2.getXPos() ? obj2 : obj1;
|
||||
|
||||
if ((right.getXPos() + right.getWidth() * right.getScalingFactor()) > viewXPos + dimension){
|
||||
vec.x = - Math.abs((right.getXPos() + right.getWidth() * right.getScalingFactor()) - (viewXPos + dimension));
|
||||
} else if (left.getXPos() < viewXPos - dimension){
|
||||
vec.x = Math.abs(left.getXPos() - (viewXPos - dimension));
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
}
|
60
src/main/java/engine/camera/TrackingTore.java
Normal file
@ -0,0 +1,60 @@
|
||||
package engine.camera;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.ObjectGl;
|
||||
|
||||
/**
|
||||
* Pas fini et c'est de la merde
|
||||
*/
|
||||
public class TrackingTore implements TrackingDummy {
|
||||
|
||||
private float rayonExt;
|
||||
private final float offset;
|
||||
private final ObjectGl obj1;
|
||||
private final ObjectGl obj2;
|
||||
private final Engine engine;
|
||||
|
||||
/**
|
||||
* Centre la camera entre les deux objets assure un niveau de zoom suffisant pour voir les deux objets //TODO ajouter une zone morte + interpolation
|
||||
* @param offset
|
||||
* @param obj1
|
||||
* @param obj2
|
||||
* @param engine
|
||||
*/
|
||||
public TrackingTore(float offset, ObjectGl obj1, ObjectGl obj2, Engine engine){
|
||||
this.rayonExt = offset;
|
||||
this.offset = offset;
|
||||
this.obj1 = obj1;
|
||||
this.obj2 = obj2;
|
||||
this.engine = engine;
|
||||
}
|
||||
|
||||
public Vector3f getViewVector(){
|
||||
Vector3f vec = new Vector3f(0.0f,0.0f,0.0f);
|
||||
|
||||
//which object is to the left
|
||||
ObjectGl left = obj1.getXPos() >= obj2.getXPos() ? obj2 : obj1;
|
||||
ObjectGl right = obj1.getXPos() < obj2.getXPos() ? obj2 : obj1;
|
||||
|
||||
//Track his current position and other useful data
|
||||
float xPos = this.engine.getViewXPos();
|
||||
float dimension = this.engine.getCamera().getDimension();
|
||||
float distance = Math.abs(left.getXPos() - (right.getXPos()) + right.getWidth() * right.getScalingFactor()) + 1500.0f; // Il faut un offset sinon si la distance est de 0 on a la camera qui zoom vers l'infini
|
||||
float middle_point = (left.getXPos() + (right.getXPos() + right.getWidth() * right.getScalingFactor())) / 2;
|
||||
|
||||
vec.x = -middle_point - xPos;
|
||||
this.engine.getCamera().zoom((distance / 2)/dimension);
|
||||
|
||||
if (left.getXPos() < xPos - rayonExt){
|
||||
// le rayonExt augmente + dezoom
|
||||
} else if(left.getXPos() > xPos - rayonExt + offset){
|
||||
// le rayonExt diminue + zoom
|
||||
} else if(right.getXPos() > xPos + rayonExt){
|
||||
// le rayonExt augmente + dezoom
|
||||
} else if(right.getXPos() < xPos + rayonExt - offset){
|
||||
// le rayonExt diminue + zoom
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
}
|
75
src/main/java/engine/graphics/Shader.java
Normal file
@ -0,0 +1,75 @@
|
||||
package engine.graphics;
|
||||
|
||||
import engine.math.Matrix4f;
|
||||
import engine.utils.ShaderUtils;
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.lwjgl.opengl.GL20.*;
|
||||
|
||||
public class Shader {
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
//Identifiant du programme resultat de la compilation des shaders
|
||||
private final int ID;
|
||||
private final Map<String, Integer> locationCache = new HashMap<String, Integer>();
|
||||
|
||||
/*
|
||||
Crée le fragment et le vertex shader les lie dans un programme dont il renvoie l'identifiant.
|
||||
*/
|
||||
public Shader(String vertex, String fragment) {
|
||||
ID = ShaderUtils.load(vertex, fragment);
|
||||
}
|
||||
|
||||
public int getUniform(String name){
|
||||
if (locationCache.containsKey(name)) return locationCache.get(name);
|
||||
int result = glGetUniformLocation(ID, name);
|
||||
if (result == -1) System.err.println("Could not find uniform variable " + name);
|
||||
else locationCache.put(name, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setUniform1i(String name, int value) {
|
||||
if (!enabled) enable();
|
||||
glUniform1i(getUniform(name), value);
|
||||
}
|
||||
|
||||
public void setUniform1f(String name, float value) {
|
||||
if (!enabled) enable();
|
||||
glUniform1f(getUniform(name), value);
|
||||
}
|
||||
|
||||
public void setUniform2f(String name, float x, float y) {
|
||||
if (!enabled) enable();
|
||||
glUniform2f(getUniform(name), x, y);
|
||||
}
|
||||
|
||||
public void setUniform3f(String name, Vector3f vector) {
|
||||
if (!enabled) enable();
|
||||
glUniform3f(getUniform(name), vector.x, vector.y, vector.z);
|
||||
}
|
||||
|
||||
public void setUniform4f(String name, float x, float y, float z, float w) {
|
||||
if (!enabled) enable();
|
||||
glUniform4f(getUniform(name), x, y, z, w);
|
||||
}
|
||||
|
||||
public void setUniformMat4f(String name, Matrix4f matrix){
|
||||
if (!enabled) enable();
|
||||
glUniformMatrix4fv(getUniform(name), false, matrix.toFloatBuffer());
|
||||
}
|
||||
|
||||
public void enable() {
|
||||
glUseProgram(ID);
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
glUseProgram(0);
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
}
|
75
src/main/java/engine/graphics/Texture.java
Normal file
@ -0,0 +1,75 @@
|
||||
package engine.graphics;
|
||||
|
||||
import engine.utils.BufferUtilsEngine;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL30.*;
|
||||
|
||||
public class Texture {
|
||||
|
||||
private int width, height;
|
||||
private int texture;
|
||||
private int index;
|
||||
|
||||
public Texture(String path, int index) {
|
||||
this.index = index;
|
||||
texture = load(path);
|
||||
}
|
||||
|
||||
private int load(String path) {
|
||||
int[] pixels = null;
|
||||
try {
|
||||
BufferedImage image = ImageIO.read(getClass().getResourceAsStream(path));
|
||||
width = image.getWidth();
|
||||
height = image.getHeight();
|
||||
pixels = new int[width * height];
|
||||
image.getRGB(0, 0, width, height, pixels, 0, width);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
int[] data = new int[width * height];
|
||||
for (int i = 0; i < width * height; i++) {
|
||||
int a = (pixels[i] & 0xff000000) >> 24;
|
||||
int r = (pixels[i] & 0xff0000) >> 16;
|
||||
int g = (pixels[i] & 0xff00) >> 8;
|
||||
int b = (pixels[i] & 0xff);
|
||||
|
||||
data[i] = a << 24 | b << 16 | g << 8 | r;
|
||||
}
|
||||
|
||||
int result = glGenTextures();
|
||||
glBindTexture(GL_TEXTURE_2D, result);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
GL11.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, BufferUtilsEngine.createIntBuffer(data));
|
||||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void bind() {
|
||||
glActiveTexture(GL_TEXTURE0 + this.index);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
}
|
||||
|
||||
public void unbind() {
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
public int getWidth(){
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight(){
|
||||
return height;
|
||||
}
|
||||
|
||||
}
|
100
src/main/java/engine/graphics/VertexArray.java
Normal file
@ -0,0 +1,100 @@
|
||||
package engine.graphics;
|
||||
|
||||
import engine.utils.BufferUtilsEngine;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL15.*;
|
||||
import static org.lwjgl.opengl.GL30.*;
|
||||
|
||||
public class VertexArray {
|
||||
|
||||
private int VAO ,VBO, EBO, CBO, TBO;
|
||||
private int count;
|
||||
|
||||
public VertexArray(float[] vertices, byte[] indices, float[] color, float[] texture) {
|
||||
count = indices.length;
|
||||
// VERTEX ARRAY OBJECT
|
||||
VAO = glGenVertexArrays();
|
||||
glBindVertexArray(VAO);
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
// VERTEX BUFFER OBJECT
|
||||
createVertexBufferObject(vertices);
|
||||
// COLOR BUFFER OBJECT
|
||||
if (color != null) createColorBufferObject(color);
|
||||
// TEXTURE BUFFER OBJECT
|
||||
if (texture != null) createTextureBufferObject(texture);
|
||||
|
||||
EBO = glGenBuffers();
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, BufferUtilsEngine.createByteBuffer(indices), GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
}
|
||||
|
||||
private void createVertexBufferObject(float[] vertices){
|
||||
VBO = glGenBuffers();
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, BufferUtilsEngine.createFloatBuffer(vertices), GL_STATIC_DRAW);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
|
||||
glEnableVertexAttribArray(0);
|
||||
}
|
||||
|
||||
private void createColorBufferObject(float[] color){
|
||||
CBO = glGenBuffers();
|
||||
glBindBuffer(GL_ARRAY_BUFFER, CBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, BufferUtilsEngine.createFloatBuffer(color), GL_STATIC_DRAW);
|
||||
glVertexAttribPointer(1, 3, GL_FLOAT, false, 0, 0);
|
||||
glEnableVertexAttribArray(1);
|
||||
}
|
||||
|
||||
private void createTextureBufferObject(float[] texture){
|
||||
TBO = glGenBuffers();
|
||||
glBindBuffer(GL_ARRAY_BUFFER, TBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, BufferUtilsEngine.createFloatBuffer(texture), GL_STATIC_DRAW);
|
||||
glVertexAttribPointer(2, 2, GL_FLOAT, false, 0, 0);
|
||||
glEnableVertexAttribArray(2);
|
||||
}
|
||||
|
||||
public void swapVertexBufferObject(float[] vertices){
|
||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, BufferUtilsEngine.createFloatBuffer(vertices), GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
public void swapTextureBufferObject(float [] texture){
|
||||
glBindBuffer(GL_ARRAY_BUFFER, TBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, BufferUtilsEngine.createFloatBuffer(texture), GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
public void bind(){
|
||||
glBindVertexArray(this.VAO);
|
||||
}
|
||||
|
||||
public void unbind(){
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
public void draw(){
|
||||
glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_BYTE, 0);
|
||||
}
|
||||
|
||||
public void render(){
|
||||
bind();
|
||||
draw();
|
||||
unbind();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete every buffers used
|
||||
*/
|
||||
public void delete(){
|
||||
glDeleteBuffers(VBO);
|
||||
glDeleteBuffers(EBO);
|
||||
glDeleteBuffers(CBO);
|
||||
glDeleteBuffers(TBO);
|
||||
glDeleteVertexArrays(VAO);
|
||||
}
|
||||
|
||||
}
|
42
src/main/java/engine/gui/UIDummy.java
Normal file
@ -0,0 +1,42 @@
|
||||
package engine.gui;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.camera.Camera;
|
||||
|
||||
/**
|
||||
* Classe dont hérite tous les autres élements d'interface
|
||||
*/
|
||||
public abstract class UIDummy {
|
||||
|
||||
protected Engine engine;
|
||||
protected Camera camera;
|
||||
protected float xPos;
|
||||
protected float yPos;
|
||||
protected float zPos;
|
||||
protected float scalingFactor;
|
||||
|
||||
public void init(){
|
||||
}
|
||||
|
||||
public void delete(){
|
||||
}
|
||||
|
||||
protected void getObjInPosition(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Method pour le moteur ne pas utiliser
|
||||
* @param scaleFactor tqt fréro
|
||||
*/
|
||||
public void updateScalingFactor(float scaleFactor){
|
||||
this.scalingFactor *= scaleFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalcule la position de l'objet pour qu'il soit adapté au changement dans la projection ou de la position de la camera
|
||||
* Si l'objet est correctement initialisé par un moteur ne pas utiliser !
|
||||
*/
|
||||
public void update(){
|
||||
this.getObjInPosition();
|
||||
}
|
||||
}
|
56
src/main/java/engine/gui/UIElement.java
Normal file
@ -0,0 +1,56 @@
|
||||
package engine.gui;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.ObjectGl;
|
||||
|
||||
/**
|
||||
* Affiche un seul ObjectGl le lie à une position dans la zone de projection
|
||||
*/
|
||||
public class UIElement extends UIDummy{
|
||||
|
||||
private final ObjectGl obj;
|
||||
|
||||
/**
|
||||
* Crée un elements d'interface càd un sprite qui suis les mouvements de la camera, pas besoin d'ajouter l'ObjectGl
|
||||
* dans la liste de rendu cette classe s'en occupe lors de l'initialisation
|
||||
* @param obj l'objet à mettre dans le conteneur
|
||||
* @param posX la position relative à la camera souhaité sur l'axe X, 0.0 à l'extreme gauche, 1.0 à l'extreme droite
|
||||
* @param posY la position relative à la camera souhaité sur l'axe Y, 0.0 à l'extreme bas, 1.0 à l'extreme haut
|
||||
* @param engine le moteur de rendu depuis lequel UIElement va determiner la camera à tracker
|
||||
*/
|
||||
public UIElement(ObjectGl obj, float posX, float posY, Engine engine){
|
||||
this.obj = obj;
|
||||
this.engine = engine;
|
||||
this.camera = engine.getCamera();
|
||||
this.scalingFactor = obj.getScalingFactor();
|
||||
this.xPos = posX;
|
||||
this.yPos = posY;
|
||||
this.zPos = obj.getZPos();
|
||||
this.getObjInPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajoute l'ObjectGl lié à la liste de rendu du moteur lié
|
||||
*/
|
||||
public void init(){
|
||||
this.engine.add_objectGl(obj);
|
||||
}
|
||||
|
||||
public void delete(){
|
||||
this.engine.remove_objectGl(obj);
|
||||
}
|
||||
|
||||
protected void getObjInPosition(){
|
||||
obj.resetTransform();
|
||||
obj.scale(new Vector3f(this.scalingFactor, this.scalingFactor, 1.0f));
|
||||
// Position in the camera space
|
||||
float dimension = this.camera.getDimension();
|
||||
float ar = this.camera.getAspectRatio().y / this.camera.getAspectRatio().x;
|
||||
float x = dimension * 2 * this.xPos - dimension;
|
||||
float y = dimension * ar * 2 * this.yPos - dimension * ar;
|
||||
obj.translate(new Vector3f(x, y, this.zPos));
|
||||
// Camera position
|
||||
obj.translate(new Vector3f(- engine.getTransformationView().x, -engine.getTransformationView().y));
|
||||
}
|
||||
}
|
110
src/main/java/engine/gui/UIElementText.java
Normal file
@ -0,0 +1,110 @@
|
||||
package engine.gui;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.Letter;
|
||||
import engine.object.ObjectGl;
|
||||
import engine.object_wrapper.Text;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Affiche du texte le lie à une position dans la zone de projection
|
||||
*/
|
||||
public class UIElementText extends UIDummy{
|
||||
|
||||
private List<Letter> objs;
|
||||
private final Text txt;
|
||||
private ObjectGl background;
|
||||
private Vector3f colorBg;
|
||||
|
||||
/**
|
||||
* Crée du texte qui suit la caméra
|
||||
* @param texte le texte à afficher initialement
|
||||
* @param posX la position relative à la camera souhaité sur l'axe X, 0.0 à l'extreme gauche, 1.0 à l'extreme droite
|
||||
* @param posY la position relative à la camera souhaité sur l'axe Y, 0.0 à l'extreme bas, 1.0 à l'extreme haut
|
||||
* @param engine le moteur de rendu depuis lequel UIElement va determiner la camera à tracker
|
||||
*/
|
||||
public UIElementText(String texte, float size, float posX, float posY, float posZ, Engine engine){
|
||||
this.txt = new Text(texte, posZ, size, engine);
|
||||
this.objs = this.txt.getCharList();
|
||||
this.engine = engine;
|
||||
this.camera = engine.getCamera();
|
||||
this.scalingFactor = size;
|
||||
this.xPos = posX;
|
||||
this.yPos = posY;
|
||||
this.zPos = posZ;
|
||||
this.getObjInPosition();
|
||||
this.background = null;
|
||||
}
|
||||
|
||||
public void setBackground(Vector3f color){
|
||||
this.colorBg = color;
|
||||
this.background = new ObjectGl(this.zPos, objs.size() * 10f, 10f, this.scalingFactor - 0.1f, null, this.colorBg );
|
||||
engine.add_objectGl(this.background);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajouter l'element à la liste de rendu du moteur dont il est lié.
|
||||
*/
|
||||
public void init(){
|
||||
for (ObjectGl obj : this.txt.getCharList()){
|
||||
this.engine.add_objectGl(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(){
|
||||
for (ObjectGl obj : this.txt.getCharList()){ //Cast en ObjectGl
|
||||
this.engine.remove_objectGl(obj);
|
||||
}
|
||||
if (background != null){
|
||||
this.engine.remove_objectGl(background);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifier le texte
|
||||
* @param txt le nouveau texte
|
||||
*/
|
||||
public void setText(String txt){
|
||||
this.txt.setNewText(txt);
|
||||
this.objs = this.txt.getCharList(); //Trop bizarre, on dirait que this.objs prends bien en compte le rajout des nouveaux elements mais pas les suppressions ??????????????
|
||||
if (this.background != null){
|
||||
engine.remove_objectGl(background);
|
||||
setBackground(this.colorBg);
|
||||
}
|
||||
}
|
||||
|
||||
public void setShader(String vert, String frag, boolean indexBasedShader, boolean useTime){
|
||||
for (Letter l : this.txt.getCharList()){
|
||||
l.setShader(vert, frag);
|
||||
l.setIndexBasedShader(indexBasedShader);
|
||||
l.useTime = useTime;
|
||||
}
|
||||
}
|
||||
|
||||
protected void getObjInPosition(){
|
||||
int i = 0;
|
||||
float dimension = this.camera.getDimension();
|
||||
float ar = this.camera.getAspectRatio().y / this.camera.getAspectRatio().x;
|
||||
float x = dimension * 2 * this.xPos - dimension;
|
||||
float y = dimension * ar * 2 * this.yPos - dimension * ar;
|
||||
for (ObjectGl obj : this.txt.getCharList()){
|
||||
obj.resetTransform();
|
||||
obj.scale(new Vector3f(this.scalingFactor, this.scalingFactor, 1.0f));
|
||||
// Position in the camera space
|
||||
obj.translate(new Vector3f(x, y, this.zPos));
|
||||
obj.translate(new Vector3f(10.0f * i * this.scalingFactor)); // 10.0f est dependant de la taille de la police à changer si besoin rendre dynamique si plusieurs police
|
||||
// Camera position
|
||||
obj.translate(new Vector3f(- engine.getTransformationView().x, - engine.getTransformationView().y));
|
||||
i++;
|
||||
}
|
||||
if (background != null){
|
||||
background.resetTransform();
|
||||
background.scale(new Vector3f(this.scalingFactor, this.scalingFactor, 1f));
|
||||
background.translate(new Vector3f(x, y, this.zPos - 1f));
|
||||
background.translate(new Vector3f(- engine.getTransformationView().x, - engine.getTransformationView().y));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
126
src/main/java/engine/gui/UIInputList.java
Normal file
@ -0,0 +1,126 @@
|
||||
package engine.gui;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.loader.ControllerPromptTextureLoader;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.ObjectGl;
|
||||
import gameplay.input.InputBuffer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UIInputList extends UIDummy{
|
||||
|
||||
private InputBuffer inputBuffer;
|
||||
private int posBuffer;
|
||||
private int sizeBuffer;
|
||||
private List<ObjectGl> listIcon;
|
||||
private ControllerPromptTextureLoader tex;
|
||||
|
||||
private boolean[] tab;
|
||||
|
||||
public UIInputList(InputBuffer inputBuffer, float size, float posX, float posY, float posZ, Engine engine){
|
||||
this.engine = engine;
|
||||
this.camera = engine.getCamera();
|
||||
this.scalingFactor = size;
|
||||
this.xPos = posX;
|
||||
this.yPos = posY;
|
||||
this.zPos = posZ;
|
||||
this.inputBuffer = inputBuffer;
|
||||
this.tex = new ControllerPromptTextureLoader();
|
||||
this.tab = new boolean[8];
|
||||
}
|
||||
|
||||
public void init(){
|
||||
this.posBuffer = this.inputBuffer.getPos();
|
||||
this.sizeBuffer = this.inputBuffer.getSize();
|
||||
this.listIcon = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void delete(){
|
||||
for (ObjectGl obj : this.listIcon){ //Cast en ObjectGl
|
||||
this.engine.remove_objectGl(obj);
|
||||
}
|
||||
}
|
||||
|
||||
protected void getObjInPosition(){
|
||||
int index = 0;
|
||||
for (ObjectGl obj : listIcon){
|
||||
obj.resetTransform();
|
||||
obj.scale(new Vector3f(this.scalingFactor, this.scalingFactor, 1.0f));
|
||||
// Position in the camera space
|
||||
float dimension = this.camera.getDimension();
|
||||
float ar = this.camera.getAspectRatio().y / this.camera.getAspectRatio().x;
|
||||
float x = dimension * 2 * this.xPos - dimension;
|
||||
float y = dimension * ar * 2 * this.yPos - dimension * ar;
|
||||
obj.translate(new Vector3f(x, y, this.zPos));
|
||||
// Camera position
|
||||
obj.translate(new Vector3f(- engine.getTransformationView().x, -engine.getTransformationView().y));
|
||||
obj.translate(new Vector3f(index * 10 * this.scalingFactor, 0f, 0f));
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
public void createNextButton(int i){
|
||||
boolean[] input = inputBuffer.getInputList()[i].getTab();
|
||||
ObjectGl obj = null;
|
||||
if (input[0] && !tab[0]) {
|
||||
// UP
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.up);
|
||||
} if (input[1] && !tab[1]){
|
||||
// DOWN
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.down);
|
||||
} if (input[2] && !tab[2]){ //Pour l'instant on fait comme si l'avant était toujours à droite donc arrière à gauche
|
||||
// BACK
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.left);
|
||||
} if (input[3] && !tab[3]){
|
||||
// FORWARD
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.right);
|
||||
} if (input[4] && !tab[4]){
|
||||
// A
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.X);
|
||||
} if (input[5] && !tab[5]){
|
||||
// B
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.A);
|
||||
} if (input[6] && !tab[6]){
|
||||
// C
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.Y);
|
||||
} if (input[7] && !tab[7]){
|
||||
// D
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.B);
|
||||
}
|
||||
for (int k = 0; k < 8; k++){
|
||||
tab[k] = input[k];
|
||||
}
|
||||
if (obj != null){
|
||||
listIcon.add(obj);
|
||||
obj.setShader("shaders/ObjectGlTex/vert.glsl", "shaders/ObjectGlTex/frag.glsl");
|
||||
engine.add_objectGl(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void createButtonList(){
|
||||
|
||||
createNextButton(this.posBuffer);
|
||||
|
||||
if(listIcon.size() > 15){
|
||||
engine.remove_objectGl(listIcon.get(0));
|
||||
listIcon.remove(listIcon.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
public void update(){
|
||||
this.posBuffer = this.inputBuffer.getPos();
|
||||
createButtonList();
|
||||
// Mettre à la bonne position
|
||||
this.getObjInPosition();
|
||||
}
|
||||
}
|
36
src/main/java/engine/input/Button.java
Normal file
@ -0,0 +1,36 @@
|
||||
package engine.input;
|
||||
|
||||
import engine.Engine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetKey;
|
||||
|
||||
public class Button {
|
||||
|
||||
public String name;
|
||||
private final List<Integer> buttonsGamepad;
|
||||
private final List<Integer> buttonsKeyboard;
|
||||
private final GamepadInput controller;
|
||||
|
||||
public Button(String name, List<Integer> buttonsGamepad, List<Integer> buttonsKeyboard, GamepadInput controller){
|
||||
this.name = name;
|
||||
this.buttonsGamepad = buttonsGamepad;
|
||||
this.buttonsKeyboard = buttonsKeyboard;
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
public boolean isButtonPressed(){
|
||||
if (controller != null){
|
||||
for (int i : buttonsGamepad){
|
||||
if (controller.checkPressed(i)) return true;
|
||||
}
|
||||
}
|
||||
for (int i : buttonsKeyboard){
|
||||
if (glfwGetKey(Engine.getWindow(), i) == 1) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
114
src/main/java/engine/input/GamepadInput.java
Normal file
@ -0,0 +1,114 @@
|
||||
package engine.input;
|
||||
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import static engine.input.InputConst.*;
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
/* Buttons
|
||||
0 : Croix / A
|
||||
1: rond /B
|
||||
2: carré / X
|
||||
3: triangle / Y
|
||||
4: L1 / LB
|
||||
5: R1 / RB
|
||||
6:select
|
||||
7:start
|
||||
8:L3
|
||||
9:R3
|
||||
10: haut
|
||||
11: droite
|
||||
12: bas
|
||||
13: gauche
|
||||
*/
|
||||
|
||||
/* Axes
|
||||
0 : left X axe ( right : 1 left -1)
|
||||
1: left Y axe ( down : 1 , Up -1)
|
||||
2: right X axe ( right : 1 left -1)
|
||||
3: right Y axe ( down : 1 , Up -1)
|
||||
4:L2 / LT : 1 active, -1 unactive
|
||||
5: R2 /RT : 1 active, -1 unactive
|
||||
*/
|
||||
|
||||
public class GamepadInput {
|
||||
|
||||
private final int gamepadNum;
|
||||
private ByteBuffer gamepadButton;
|
||||
private FloatBuffer gamepadAxes;
|
||||
|
||||
public GamepadInput (int gamepadNum){
|
||||
this.gamepadNum = gamepadNum;
|
||||
this.gamepadAxes = null;
|
||||
this.gamepadButton = null;
|
||||
}
|
||||
|
||||
public void inputRefresh() {
|
||||
|
||||
this.gamepadButton = glfwGetJoystickButtons(this.gamepadNum);
|
||||
this.gamepadAxes = glfwGetJoystickAxes(this.gamepadNum);
|
||||
|
||||
assert gamepadAxes != null;
|
||||
assert gamepadButton != null;
|
||||
|
||||
}
|
||||
|
||||
public boolean checkPressed(int keyCode){
|
||||
this.gamepadButton = glfwGetJoystickButtons(this.gamepadNum);
|
||||
|
||||
assert gamepadButton != null;
|
||||
|
||||
return gamepadButton.get(keyCode) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie la position du stick pointé par axisId sous forme de direction général (9 directions)
|
||||
* @param axisId l'identifiant du joystick (AXE X)
|
||||
* @return la direction du stick valeur possible : RIGHT, UPPER_RIGHT, UP, UPPER_LEFT, LEFT, LOWER_LEFT, DOWN, LOWER_RIGHT, CENTER;
|
||||
*/
|
||||
public int getAxisDiscreet(int axisId){
|
||||
|
||||
float x = gamepadAxes.get(axisId);
|
||||
float y = gamepadAxes.get(axisId + 1);
|
||||
|
||||
float magnitude = (float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
||||
float angle = (float) Math.toDegrees(2 * Math.atan(y /(x + magnitude)));
|
||||
|
||||
if (magnitude < 0.3) return CENTER;
|
||||
if (angle < 22.5 && angle > -22.5) return RIGHT;
|
||||
else if (angle > -67.5 && angle < -22.5) return UPPER_RIGHT;
|
||||
else if (angle > -112.5 && angle < -67.5) return UP_STICK;
|
||||
else if (angle > -157.5 && angle < -112.5) return UPPER_LEFT;
|
||||
else if (angle < -157.5 || angle > 157.5) return LEFT;
|
||||
else if (angle < 157.5 && angle > 112.5) return LOWER_LEFT;
|
||||
else if (angle < 112.5 && angle > 67.5) return DOWN_STICK;
|
||||
else if (angle < 67.5 && angle > 22.5) return LOWER_RIGHT;
|
||||
|
||||
return -1; // TEST
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoie la position du stick pointé par axisID (AXE X) sous forme de Vecteur
|
||||
* @param axisId l'identifiant du joystick (AXE X)
|
||||
* @return un Vecteur représentant la position actuel du joystick
|
||||
*/
|
||||
public Vector3f getAxisContinuous(int axisId){
|
||||
|
||||
float x = gamepadAxes.get(axisId);
|
||||
float y = gamepadAxes.get(axisId + 1);
|
||||
|
||||
if (x < 0.1 && x > -0.1) x = 0;
|
||||
if (y < 0.1 && y > -0.1) y = 0;
|
||||
|
||||
System.out.println("x: " + x + " y: " + y);
|
||||
|
||||
return new Vector3f(x,y);
|
||||
}
|
||||
|
||||
public String getGamepadName(){
|
||||
return glfwGetGamepadName(this.gamepadNum);
|
||||
}
|
||||
|
||||
}
|
17
src/main/java/engine/input/InputConst.java
Normal file
@ -0,0 +1,17 @@
|
||||
package engine.input;
|
||||
|
||||
public class InputConst {
|
||||
/*
|
||||
ButtonIG ID
|
||||
*/
|
||||
public final static int buttonA=0, buttonB=1, buttonX=2, buttonY=3, LB = 4, RB = 5, select = 6, start = 7,
|
||||
L_JoystickClick = 8, R_JoystickClick =9, up = 10, right = 11, down = 12, left = 13;
|
||||
|
||||
/*
|
||||
Axis ID
|
||||
*/
|
||||
public final static int leftJoyX_Axe = 0, leftJoyY_Axe = 1, rightJoyX_Axe = 2, rightJoyY_Axe = 3, LT = 4, RT = 5;
|
||||
|
||||
public final static int RIGHT = 0, UPPER_RIGHT = 1, UP_STICK = 2, UPPER_LEFT = 3, LEFT = 4, LOWER_LEFT = 5,
|
||||
DOWN_STICK = 6, LOWER_RIGHT = 7, CENTER = 8;
|
||||
}
|
58
src/main/java/engine/input/KeyboardInput.java
Normal file
@ -0,0 +1,58 @@
|
||||
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;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class KeyboardInput extends GLFWKeyCallback {
|
||||
|
||||
public static boolean[] keys = new boolean[65536];
|
||||
|
||||
@Override
|
||||
public void invoke(long window, int key, int scancode, int action, int mods) {
|
||||
keys[key] = action != GLFW.GLFW_RELEASE;
|
||||
if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||
glfwSetWindowShouldClose(window, true);
|
||||
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) {
|
||||
return glfwGetKey(Engine.getWindow(), keyCode) == 1;
|
||||
}
|
||||
|
||||
public static void keyboardInput(ObjectGl token, int speed) {
|
||||
boolean keyPressed = false;
|
||||
if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_S)) {
|
||||
token.setTextureWrap(161,260,56,59);
|
||||
keyPressed = true;
|
||||
} else if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_W)) {
|
||||
keyPressed = true;
|
||||
}
|
||||
if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_A)) {
|
||||
token.translate(new Vector3f (speed * -1.0f, 0.0f, 0.0f));
|
||||
token.setTextureWrap(121,0,57,82);
|
||||
keyPressed = true;
|
||||
}
|
||||
else if (KeyboardInput.isKeyDown(GLFW.GLFW_KEY_D)) {
|
||||
token.translate(new Vector3f (speed * 1.0f, 0.0f, 0.0f));
|
||||
token.setTextureWrap(178,0,62,82);
|
||||
keyPressed = true;
|
||||
}
|
||||
if (!keyPressed) token.setTextureWrap(58,0,62,82);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package engine.loader;
|
||||
|
||||
import engine.graphics.Texture;
|
||||
|
||||
public class ControllerPromptTextureLoader {
|
||||
|
||||
public Texture up;
|
||||
public Texture down;
|
||||
public Texture left;
|
||||
public Texture right;
|
||||
public Texture X;
|
||||
public Texture A;
|
||||
public Texture Y;
|
||||
public Texture B;
|
||||
|
||||
public ControllerPromptTextureLoader(){
|
||||
up = new Texture("/textures/keyboard_pad_glyphs/xbox/XboxOne_Dpad_Up.png", 0);
|
||||
down = new Texture("/textures/keyboard_pad_glyphs/xbox/XboxOne_Dpad_Down.png", 0);
|
||||
left = new Texture("/textures/keyboard_pad_glyphs/xbox/XboxOne_Dpad_Left.png", 0);
|
||||
right = new Texture("/textures/keyboard_pad_glyphs/xbox/XboxOne_Dpad_Right.png", 0);
|
||||
A = new Texture("/textures/keyboard_pad_glyphs/xbox/XboxOne_A.png", 0);
|
||||
B = new Texture("/textures/keyboard_pad_glyphs/xbox/XboxOne_B.png", 0);
|
||||
X = new Texture("/textures/keyboard_pad_glyphs/xbox/XboxOne_X.png", 0);
|
||||
Y = new Texture("/textures/keyboard_pad_glyphs/xbox/XboxOne_Y.png", 0);
|
||||
}
|
||||
}
|
121
src/main/java/engine/math/Matrix4f.java
Normal file
@ -0,0 +1,121 @@
|
||||
package engine.math;
|
||||
|
||||
import engine.utils.BufferUtilsEngine;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
public class Matrix4f {
|
||||
|
||||
public static final int SIZE = 4 * 4;
|
||||
public float[] elements = new float[4 * 4];
|
||||
|
||||
public Matrix4f(){
|
||||
|
||||
}
|
||||
|
||||
public static Matrix4f identity(){
|
||||
Matrix4f result = new Matrix4f();
|
||||
for (int i = 0; i < SIZE; i++){
|
||||
result.elements[i] = 0.0f;
|
||||
}
|
||||
result.elements[0 + 0 * 4] = 1.0f;
|
||||
result.elements[1 + 1 * 4] = 1.0f;
|
||||
result.elements[2 + 2 * 4] = 1.0f;
|
||||
result.elements[3 + 3 * 4] = 1.0f;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Matrix4f orthographic(float left, float right, float bottom, float top, float near, float far){
|
||||
Matrix4f result = identity();
|
||||
|
||||
result.elements[0 + 0 * 4] = 2.0f / (right - left);
|
||||
result.elements[1 + 1 * 4] = 2.0f / (top - bottom);
|
||||
result.elements[2 + 2 * 4] = 2.0f / (near - far);
|
||||
|
||||
result.elements[0 + 3 * 4] = (left + right) / (left - right);
|
||||
result.elements[1 + 3 * 4] = (bottom + top) / (bottom - top);
|
||||
result.elements[2 + 3 * 4] = (far + near) / (far - near);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Matrix4f translate(Vector3f vector){
|
||||
Matrix4f result = identity();
|
||||
result.elements[0 + 3*4] = vector.x;
|
||||
result.elements[1 + 3*4] = vector.y;
|
||||
result.elements[2 + 3*4] = vector.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Matrix4f scale(Vector3f vector){
|
||||
Matrix4f result = identity();
|
||||
result.elements[0 + 0*4] = vector.x;
|
||||
result.elements[1 + 1*4] = vector.y;
|
||||
result.elements[2 + 2*4] = vector.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Matrix4f rotateX(float angle){
|
||||
Matrix4f result = identity();
|
||||
float r = (float) Math.toRadians(angle);
|
||||
float cos = (float) Math.cos(r);
|
||||
float sin = (float) Math.sin(r);
|
||||
|
||||
result.elements[1 + 1 * 4] = cos;
|
||||
result.elements[2 + 1 * 4] = -sin;
|
||||
|
||||
result.elements[1 + 2 * 4] = sin;
|
||||
result.elements[2 + 2 * 4] = cos;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Matrix4f rotateY(float angle){
|
||||
Matrix4f result = identity();
|
||||
float r = (float) Math.toRadians(angle);
|
||||
float cos = (float) Math.cos(r);
|
||||
float sin = (float) Math.sin(r);
|
||||
|
||||
result.elements[0 + 0 * 4] = cos;
|
||||
result.elements[2 + 0 * 4] = sin;
|
||||
|
||||
result.elements[0 + 2 * 4] = -sin;
|
||||
result.elements[2 + 2 * 4] = cos;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Matrix4f rotateZ(float angle){
|
||||
Matrix4f result = identity();
|
||||
float r = (float) Math.toRadians(angle);
|
||||
float cos = (float) Math.cos(r);
|
||||
float sin = (float) Math.sin(r);
|
||||
|
||||
result.elements[0 + 0 * 4] = cos;
|
||||
result.elements[1 + 0 * 4] = -sin;
|
||||
|
||||
result.elements[0 + 1 * 4] = sin;
|
||||
result.elements[1 + 1 * 4] = cos;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Matrix4f multiply(Matrix4f matrix){
|
||||
Matrix4f result = new Matrix4f();
|
||||
for (int y = 0; y< 4; y++){
|
||||
for (int x = 0; x< 4; x++){
|
||||
float sum = 0.0f;
|
||||
for (int e = 0; e< 4; e++){
|
||||
sum += this.elements[x + e * 4] * matrix.elements[e + y * 4];
|
||||
}
|
||||
result.elements[x + y * 4] = sum;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public FloatBuffer toFloatBuffer() {
|
||||
return BufferUtilsEngine.createFloatBuffer(elements);
|
||||
}
|
||||
|
||||
}
|
38
src/main/java/engine/math/Primitive.java
Normal file
@ -0,0 +1,38 @@
|
||||
package engine.math;
|
||||
|
||||
import engine.math.Vector3f;
|
||||
|
||||
public class Primitive {
|
||||
|
||||
public static float[] createRectangle(float z, float w, float h){
|
||||
return new float[] {
|
||||
0 , 0 , z, // Haut gauche
|
||||
0 + w, 0 , z, // Haut droit
|
||||
0 + w, 0 - h, z, // Bas droit
|
||||
0 , 0 - h, z // Bas gauche
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Chaque point correspond à un vertex de la primite le reste est interpolé
|
||||
*/
|
||||
public static float[] stdTexWrap = new float[] {
|
||||
0.0f, 0.0f,
|
||||
1.0f, 0.0f,
|
||||
1.0f, 1.0f,
|
||||
0.0f, 1.0f
|
||||
};
|
||||
|
||||
public static float[] upperHalfTexWrap = new float[] {
|
||||
0.0f, 0.0f,
|
||||
1.0f, 0.0f,
|
||||
1.0f, 0.5f,
|
||||
0.0f, 0.5f
|
||||
};
|
||||
|
||||
public static byte[] rectangle_indices = new byte[] {
|
||||
0, 1, 3,
|
||||
1, 2, 3
|
||||
};
|
||||
|
||||
}
|
46
src/main/java/engine/math/Vector3f.java
Normal file
@ -0,0 +1,46 @@
|
||||
package engine.math;
|
||||
|
||||
public class Vector3f {
|
||||
|
||||
public float x, y, z;
|
||||
|
||||
public Vector3f(){
|
||||
x = 0.0f;
|
||||
y = 0.0f;
|
||||
z = 0.0f;
|
||||
}
|
||||
|
||||
public Vector3f(float x){
|
||||
this.x = x;
|
||||
this.y = 0.0f;
|
||||
this.z = 0.0f;
|
||||
}
|
||||
|
||||
public Vector3f(float x, float y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = 0.0f;
|
||||
}
|
||||
|
||||
public Vector3f(float x, float y, float z){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Vector3f addXYZ(Vector3f vec){
|
||||
return new Vector3f(this.x + vec.x, this.y + vec.y, this.z += vec.z);
|
||||
}
|
||||
|
||||
public Vector3f divXY(float div){
|
||||
return new Vector3f(this.x / div, this.y / div, this.z);
|
||||
}
|
||||
|
||||
public Vector3f divXYZ(float div){
|
||||
return new Vector3f(this.x / div, this.y / div, this.z / div);
|
||||
}
|
||||
|
||||
public static Vector3f vectorBetweenTwoPoint(Vector3f origin, Vector3f target){
|
||||
return new Vector3f(target.x - origin.x, target.y - origin.y, target.z - origin.z);
|
||||
}
|
||||
}
|
23
src/main/java/engine/object/Hitbox.java
Normal file
@ -0,0 +1,23 @@
|
||||
package engine.object;
|
||||
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetTime;
|
||||
|
||||
public class Hitbox extends ObjectGl{
|
||||
|
||||
public Hitbox(float z, float w, float h, float size, Vector3f color) {
|
||||
super(z, w, h, size, null, color);
|
||||
this.setShader("/shaders/ObjectGlColor/vert.glsl", "/shaders/StylishShaders/HitboxFrag.glsl");
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void uniformInjection(){
|
||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||
|
||||
this.shader.setUniformMat4f("projection", projection);
|
||||
this.shader.setUniformMat4f("view", view);
|
||||
this.shader.setUniformMat4f("transform", this.transform);
|
||||
}
|
||||
}
|
54
src/main/java/engine/object/HorizontalProgressBar.java
Normal file
@ -0,0 +1,54 @@
|
||||
package engine.object;
|
||||
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetTime;
|
||||
|
||||
public class HorizontalProgressBar extends ObjectGl {
|
||||
|
||||
private float max;
|
||||
private float current;
|
||||
private int leftToRight;
|
||||
private boolean useHeight;
|
||||
|
||||
public HorizontalProgressBar(float z, float w, float h, float size, float current, float max, boolean leftToRight) {
|
||||
super(z, w, h, size, null, new Vector3f(0f, 1f, 0f));
|
||||
this.max = max;
|
||||
this.current = current;
|
||||
this.leftToRight = leftToRight ? 1 : 0;
|
||||
this.useHeight = false;
|
||||
this.setShader("/shaders/StylishShaders/BasicNoTexVert.glsl", "/shaders/StylishShaders/HorizontalProgressBarFrag.glsl");
|
||||
}
|
||||
|
||||
public void setCurrent(float newCurrent) {
|
||||
this.current = newCurrent;
|
||||
}
|
||||
|
||||
public void setMax(float newMax) {
|
||||
this.max = newMax;
|
||||
}
|
||||
|
||||
public void setUseHeight(boolean b){
|
||||
this.useHeight = b;
|
||||
}
|
||||
|
||||
protected void uniformInjection() {
|
||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||
|
||||
if (this.leftToRight == 1) {
|
||||
this.shader.setUniform1f("fill", (this.current / this.max) * this.getWidth());
|
||||
} else {
|
||||
this.shader.setUniform1f("fill", Math.abs(((this.current / this.max) * this.getWidth()) - this.getWidth()));
|
||||
}
|
||||
|
||||
if (this.useHeight) {
|
||||
this.shader.setUniform1f("height", this.height);
|
||||
}
|
||||
|
||||
this.shader.setUniform1i("leftToRight", this.leftToRight);
|
||||
|
||||
this.shader.setUniformMat4f("projection", projection);
|
||||
this.shader.setUniformMat4f("view", view);
|
||||
this.shader.setUniformMat4f("transform", this.transform);
|
||||
}
|
||||
}
|
31
src/main/java/engine/object/Letter.java
Normal file
@ -0,0 +1,31 @@
|
||||
package engine.object;
|
||||
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetTime;
|
||||
|
||||
public class Letter extends ObjectGl {
|
||||
|
||||
private int index;
|
||||
private boolean indexBasedShader;
|
||||
|
||||
public Letter(float z, float w, float h, float size, String tex, Vector3f color, int index) {
|
||||
super(z, w, h, size, tex, color);
|
||||
this.index = index;
|
||||
this.indexBasedShader = false;
|
||||
}
|
||||
|
||||
public void setIndexBasedShader(boolean b){
|
||||
this.indexBasedShader = b;
|
||||
}
|
||||
|
||||
protected void uniformInjection(){
|
||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||
if (this.indexBasedShader) this.shader.setUniform1i("index",this.index);
|
||||
|
||||
this.shader.setUniformMat4f("projection", projection);
|
||||
this.shader.setUniformMat4f("view", view);
|
||||
this.shader.setUniformMat4f("transform", this.transform);
|
||||
}
|
||||
|
||||
}
|
298
src/main/java/engine/object/ObjectGl.java
Normal file
@ -0,0 +1,298 @@
|
||||
package engine.object;
|
||||
|
||||
import engine.graphics.*;
|
||||
import engine.math.*;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ObjectGl {
|
||||
|
||||
protected VertexArray vertexArray;
|
||||
protected Shader shader;
|
||||
protected Matrix4f transform;
|
||||
|
||||
/**
|
||||
* Projection and view matrix are set by the engine do not modify
|
||||
*/
|
||||
public static Matrix4f projection;
|
||||
public static Matrix4f view;
|
||||
|
||||
/**
|
||||
* xPos and yPos will stop to be relevant if you use rotate function
|
||||
*/
|
||||
protected float xPos;
|
||||
protected float yPos;
|
||||
protected float zPos;
|
||||
protected float xAngle;
|
||||
protected float yAngle;
|
||||
protected float zAngle;
|
||||
protected float width; // To be used in setTextureWrap
|
||||
protected float height;
|
||||
protected float scalingFactor;
|
||||
|
||||
public boolean useTime;
|
||||
|
||||
protected Texture texture;
|
||||
private float[] textureWrap;
|
||||
|
||||
/**
|
||||
* Create a rectangle shape, use setTextureWrap to correctly align the texture with the model
|
||||
* @param z depth of your model the larger it is the more it will be "close" to the camera
|
||||
* @param w height of the rectangle
|
||||
* @param h width of the rectangle
|
||||
* @param size scaling factor of the rectangle, the model could not show up because this value is too small or too large, a good compromise is between 2 and 15
|
||||
* @param tex set to null if you don't want a tex on your model
|
||||
* @param color set to null if you don't want a Color on your model
|
||||
*/
|
||||
public ObjectGl(float z, float w, float h, float size, String tex, Vector3f color){
|
||||
float[] colorBuffer = null;
|
||||
// Check des options
|
||||
if (color != null){
|
||||
colorBuffer = new float[] {
|
||||
color.x, color.y, color.z,
|
||||
color.x, color.y, color.z,
|
||||
color.x, color.y, color.z,
|
||||
color.x, color.y, color.z
|
||||
};
|
||||
}
|
||||
|
||||
if (tex != null){
|
||||
this.texture = new Texture(tex, 0);
|
||||
}
|
||||
|
||||
this.xPos = 0.0f;
|
||||
this.yPos = 0.0f;
|
||||
this.zPos = z;
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
|
||||
this.textureWrap = Primitive.stdTexWrap;
|
||||
this.vertexArray = new VertexArray(Primitive.createRectangle(this.zPos, this.width, this.height), Primitive.rectangle_indices, colorBuffer, Primitive.stdTexWrap);
|
||||
|
||||
this.scalingFactor = 1;
|
||||
this.transform = Matrix4f.identity();
|
||||
this.scale(new Vector3f(size, size,1.0f));
|
||||
this.useTime = false;
|
||||
|
||||
// use different shader for each set of option
|
||||
if (tex == null && color == null){
|
||||
this.shader = new Shader("/shaders/ObjectGl/vert.glsl","/shaders/ObjectGl/frag.glsl");
|
||||
} else if (tex == null){
|
||||
this.shader = new Shader("/shaders/ObjectGlColor/vert.glsl","/shaders/ObjectGlColor/frag.glsl");
|
||||
} else if (color == null){
|
||||
this.shader = new Shader("/shaders/ObjectGlTex/vert.glsl","/shaders/ObjectGlTex/frag.glsl");
|
||||
} else {
|
||||
this.shader = new Shader("/shaders/ObjectGlTexColor/vert.glsl","/shaders/ObjectGlTexColor/frag.glsl");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the transform matrix, the model will appear at the 0.0.0 coordinate, his scaleFactor will be set to one
|
||||
* Because the model is at position 0 on the z axis he will not show up on screen
|
||||
*/
|
||||
public void resetTransform(){
|
||||
this.transform = Matrix4f.identity();
|
||||
this.scalingFactor = 1;
|
||||
this.xPos = 0.0f;
|
||||
this.yPos = 0.0f;
|
||||
this.zPos = 0.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the object according to vec, direction can change if rotation method have been used
|
||||
* @param vec Vector3f
|
||||
*/
|
||||
public void translate(Vector3f vec){
|
||||
this.xPos += vec.x;
|
||||
this.yPos += vec.y;
|
||||
this.zPos += vec.z;
|
||||
Vector3f vecTemp = vec.divXYZ(this.scalingFactor);
|
||||
this.transform = this.transform.multiply(Matrix4f.translate(vecTemp));
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale the model with the vec vector, the x component is used to mitigate size modification in the behavior of other transformation method
|
||||
* @param vec Vector3f
|
||||
*/
|
||||
public void scale(Vector3f vec){
|
||||
this.scalingFactor *= vec.x;
|
||||
this.transform = this.transform.multiply(Matrix4f.scale(vec));
|
||||
}
|
||||
|
||||
/**
|
||||
* rotate the model by angle degree on the local x axis, beware this will change the behavior of the translate method
|
||||
* @param angle in degree
|
||||
*/
|
||||
public void rotateX(float angle){
|
||||
this.transform = this.transform.multiply(Matrix4f.rotateX(angle));
|
||||
}
|
||||
|
||||
/**
|
||||
* rotate the model by angle degree on the local y axis, beware this will change the behavior of the translate method
|
||||
* @param angle in degree
|
||||
*/
|
||||
public void rotateY(float angle){
|
||||
this.transform = this.transform.multiply(Matrix4f.rotateY(angle));
|
||||
}
|
||||
|
||||
/**
|
||||
* rotate the model by angle degree on the local z axis, beware this will change the behavior of the translate method
|
||||
* @param angle in degree
|
||||
*/
|
||||
public void rotateZ(float angle){
|
||||
this.transform = this.transform.multiply(Matrix4f.rotateZ(angle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new texture to be used on the model. You may need to use setTextureWrap tp get the correct wrap
|
||||
* @param texPath path to the new texture
|
||||
*/
|
||||
public void setTexture(String texPath){
|
||||
this.texture = new Texture(texPath, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new texture to be used
|
||||
* @param texture already loaded Texture
|
||||
*/
|
||||
public void setTexture(Texture texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the wrapping coordinate, beware every sprite have to be of the same size if you don't want strange behavior
|
||||
* @param x starting wrapping on the horizontal axis
|
||||
* @param y starting wrapping on the vertical axis
|
||||
* @param w the length of the wrapping on the horizontal axis
|
||||
* @param h the length of the wrapping on the vertical axis
|
||||
*/
|
||||
public void setTextureWrap(float x, float y, float w, float h){
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
this.vertexArray.swapVertexBufferObject(Primitive.createRectangle(this.zPos, w, h));
|
||||
int texWidth = this.texture.getWidth();
|
||||
int texHeight = this.texture.getHeight();
|
||||
x /= texWidth;
|
||||
w /= texWidth;
|
||||
y /= texHeight;
|
||||
h /= texHeight;
|
||||
float[] result = {
|
||||
x , y ,
|
||||
x + w , y ,
|
||||
x + w , y + h ,
|
||||
x , y + h ,
|
||||
};
|
||||
this.setTextureWrap(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the textureWrap left to right
|
||||
*/
|
||||
public void flipTextureWrapH(){
|
||||
float[] textureWrapTemp = new float[] {
|
||||
this.textureWrap[2], this.textureWrap[3],
|
||||
this.textureWrap[0], this.textureWrap[1],
|
||||
this.textureWrap[6], this.textureWrap[7],
|
||||
this.textureWrap[4], this.textureWrap[5]
|
||||
};
|
||||
setTextureWrap(textureWrapTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new shader to be used by this object
|
||||
* @param vert path to glsl Vertex Shader
|
||||
* @param frag path to glsl Fragment Shader
|
||||
*/
|
||||
public void setShader(String vert, String frag){
|
||||
this.shader = new Shader(vert, frag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new Color for the object if the shader do not use the color attrib this will make no change.
|
||||
* @param color Vector3f r,g,b format
|
||||
*/
|
||||
public void setColor(Vector3f color){
|
||||
float[] colorBuffer = new float[] {
|
||||
color.x, color.y, color.z,
|
||||
color.x, color.y, color.z,
|
||||
color.x, color.y, color.z,
|
||||
color.x, color.y, color.z
|
||||
};
|
||||
this.vertexArray = new VertexArray(Primitive.createRectangle(this.zPos, this.width, this.height), Primitive.rectangle_indices, colorBuffer, Primitive.stdTexWrap);
|
||||
}
|
||||
|
||||
public void setColorVerticalGradient(Vector3f color1, Vector3f color2){
|
||||
float[] colorBuffer = new float[] {
|
||||
color1.x, color1.y, color1.z,
|
||||
color1.x, color1.y, color1.z,
|
||||
color2.x, color2.y, color2.z,
|
||||
color2.x, color2.y, color2.z
|
||||
};
|
||||
this.vertexArray = new VertexArray(Primitive.createRectangle(this.zPos, this.width, this.height), Primitive.rectangle_indices, colorBuffer, Primitive.stdTexWrap);
|
||||
}
|
||||
|
||||
public void setTextureWrap(float[] texture){
|
||||
this.textureWrap = texture;
|
||||
this.vertexArray.swapTextureBufferObject(texture);
|
||||
}
|
||||
|
||||
public Vector3f getPos(){
|
||||
return new Vector3f(xPos, yPos, zPos);
|
||||
}
|
||||
|
||||
public float getXPos(){
|
||||
return xPos;
|
||||
}
|
||||
|
||||
public float getYPos(){
|
||||
return yPos;
|
||||
}
|
||||
|
||||
public float getZPos(){
|
||||
return zPos;
|
||||
}
|
||||
|
||||
public float getWidth(){
|
||||
return this.width;
|
||||
}
|
||||
|
||||
public float getHeight(){
|
||||
return this.height;
|
||||
}
|
||||
|
||||
public float getScalingFactor(){
|
||||
return scalingFactor;
|
||||
}
|
||||
|
||||
protected void uniformInjection(){
|
||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||
|
||||
this.shader.setUniformMat4f("projection", projection);
|
||||
this.shader.setUniformMat4f("view", view);
|
||||
this.shader.setUniformMat4f("transform", this.transform);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do shader binding, texture binding and vertexArray drawing
|
||||
*/
|
||||
public void render(){
|
||||
|
||||
this.shader.enable();
|
||||
if (this.texture != null) this.texture.bind();
|
||||
|
||||
this.uniformInjection();
|
||||
|
||||
this.vertexArray.render();
|
||||
|
||||
if (this.texture != null) this.texture.unbind();
|
||||
this.shader.disable();
|
||||
}
|
||||
|
||||
public void delete(){
|
||||
this.vertexArray.delete();
|
||||
}
|
||||
|
||||
}
|
14
src/main/java/engine/object/SortZ.java
Normal file
@ -0,0 +1,14 @@
|
||||
package engine.object;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
public class SortZ implements Comparator<ObjectGl>
|
||||
{
|
||||
public int compare(ObjectGl a, ObjectGl b)
|
||||
{
|
||||
float diff = a.getZPos() - b.getZPos();
|
||||
if (diff < 0) return -1;
|
||||
else if (diff > 0) return 1;
|
||||
else return 0;
|
||||
}
|
||||
}
|
42
src/main/java/engine/object/Sprite.java
Normal file
@ -0,0 +1,42 @@
|
||||
package engine.object;
|
||||
|
||||
import engine.math.Matrix4f;
|
||||
import engine.math.Vector3f;
|
||||
|
||||
public class Sprite extends ObjectGl {
|
||||
|
||||
private ObjectGl shadow;
|
||||
|
||||
public Sprite(float z, float size, String tex, Vector3f color) {
|
||||
super(z, 1f, 1f, size, tex, color);
|
||||
this.shadow = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the object according to vec, direction can change if rotation method have been used
|
||||
* @param vec Vector3f
|
||||
*/
|
||||
public void translate(Vector3f vec){
|
||||
this.xPos += vec.x;
|
||||
this.yPos += vec.y;
|
||||
this.zPos += vec.z;
|
||||
Vector3f vecTemp = vec.divXYZ(this.scalingFactor);
|
||||
this.transform = this.transform.multiply(Matrix4f.translate(vecTemp));
|
||||
if (this.shadow != null){
|
||||
this.shadow.translate(new Vector3f(vec.x, 0f, 0f));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajoute une ombre sous le personnage
|
||||
*/
|
||||
public void setShadow(){
|
||||
this.shadow = new ObjectGl(this.zPos, this.width, this.height * 0.3f, this.scalingFactor, "/textures/shadow.png", null);
|
||||
this.shadow.translate(new Vector3f(this.xPos, this.yPos - this.height * 4.3f, -8f)); // 8 ça fait bcp mais y du z-fighting sinon jsp pk
|
||||
}
|
||||
|
||||
public ObjectGl getShadow(){
|
||||
return this.shadow;
|
||||
}
|
||||
|
||||
}
|
128
src/main/java/engine/object_wrapper/Text.java
Normal file
@ -0,0 +1,128 @@
|
||||
package engine.object_wrapper;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.gui.UIElement;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.Letter;
|
||||
import engine.object.ObjectGl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Un texte construit selon la même logique qu'une sprite pour faire un element d'interface utilisez UIElementText
|
||||
*/
|
||||
public class Text {
|
||||
|
||||
private List<Letter> charList;
|
||||
private final float size;
|
||||
private final Engine engine;
|
||||
private final float zPos;
|
||||
|
||||
private Vector3f transformation;
|
||||
|
||||
public Text(String text, float z, float size, Engine engine){
|
||||
this.charList = new ArrayList<>();
|
||||
this.zPos = z;
|
||||
this.size = size;
|
||||
this.engine = engine;
|
||||
this.transformation = new Vector3f();
|
||||
this.textToArrayObjectGl(text);
|
||||
}
|
||||
|
||||
public void show(){
|
||||
this.addCharListInEngine();
|
||||
}
|
||||
|
||||
private void textToArrayObjectGl(String s){
|
||||
for (int i = 0; i < s.length(); i++){
|
||||
this.charList.add(this.charToObjectGl(s.charAt(i), i));
|
||||
}
|
||||
}
|
||||
|
||||
private void addCharListInEngine(){
|
||||
int i = 0;
|
||||
for (Letter obj : this.charList){
|
||||
addCharInEngine(i, obj);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void addCharInEngine(int i, Letter obj){
|
||||
obj.translate(new Vector3f(i * 10.0f * this.size, 0.0f, 0.0f));
|
||||
obj.translate(transformation);
|
||||
this.engine.add_objectGl(obj);
|
||||
}
|
||||
|
||||
public void linkToUIElement(UIElement ui){
|
||||
}
|
||||
|
||||
public void setNewText(String text){
|
||||
int i = 0;
|
||||
for (Letter obj : this.charList) {
|
||||
ObjectGlSetCharWrap(text.charAt(i), obj);
|
||||
i++;
|
||||
if (i >= text.length()) break;
|
||||
}
|
||||
while (i < text.length()){
|
||||
Letter obj = this.charToObjectGl(text.charAt(i), i);
|
||||
this.charList.add(obj);
|
||||
addCharInEngine(i, obj);
|
||||
i++;
|
||||
}
|
||||
if (i < this.charList.size()) removeFromIndexToEnd(i);
|
||||
|
||||
}
|
||||
|
||||
public void translate(Vector3f vec){
|
||||
transformation = transformation.addXYZ(vec);
|
||||
for (ObjectGl obj : this.charList){
|
||||
obj.translate(vec);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(){
|
||||
for (ObjectGl obj : this.charList){
|
||||
this.engine.remove_objectGl(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ObjectGl> getObj(){
|
||||
return new ArrayList<>(this.charList);
|
||||
}
|
||||
|
||||
private void removeFromIndexToEnd(int i){
|
||||
int j = 0;
|
||||
for (Letter objectGl : this.charList){
|
||||
if (j >= i) {
|
||||
this.engine.remove_objectGl(objectGl);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
this.charList = this.charList.subList(0, i);
|
||||
}
|
||||
|
||||
private Letter charToObjectGl(char a, int index){
|
||||
Letter objectGl = new Letter(this.zPos, 1.0f, 1.0f, this.size, "/textures/dejavu10x10_gs_tc.png", null, index);
|
||||
objectGl.setShader("/shaders/StylishShaders/BasicVert.glsl","/shaders/StylishShaders/TextFrag.glsl");
|
||||
ObjectGlSetCharWrap(a, objectGl);
|
||||
return objectGl;
|
||||
}
|
||||
|
||||
private void ObjectGlSetCharWrap(char a, ObjectGl obj){
|
||||
if (a < 132 && a > 96){
|
||||
obj.setTextureWrap(0.0f + (a - 97) * 10.0f,40.0f,10.0f,10.0f);
|
||||
}
|
||||
else if (a < 91 && a > 64){
|
||||
obj.setTextureWrap(0.0f + (a - 65) * 10.0f,30.0f,10.0f,10.0f);
|
||||
}
|
||||
else if (a < 64 && a > 31){
|
||||
obj.setTextureWrap(0.0f + (a - 32) * 10.0f,0.0f,10.0f,10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Letter> getCharList(){
|
||||
return this.charList;
|
||||
}
|
||||
|
||||
}
|
8
src/main/java/engine/package-info.java
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author François Autin
|
||||
*
|
||||
*/
|
||||
package engine;
|
87
src/main/java/engine/sound/SoundBuffer.java
Normal file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Vorbis : https://fr.wikipedia.org/wiki/Vorbis
|
||||
*/
|
||||
|
||||
|
||||
package engine.sound;
|
||||
|
||||
import engine.utils.FileUtils;
|
||||
import org.lwjgl.stb.STBVorbisInfo;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import static org.lwjgl.openal.AL10.*;
|
||||
import static org.lwjgl.stb.STBVorbis.*;
|
||||
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||
|
||||
/**
|
||||
* Prends un fichier .ogg, crée un buffer associé utilisable par openAl
|
||||
* Vorbis : https://fr.wikipedia.org/wiki/Vorbis
|
||||
*/
|
||||
public class SoundBuffer {
|
||||
|
||||
private final int bufferId;
|
||||
|
||||
private ShortBuffer pcm = null;
|
||||
|
||||
private ByteBuffer vorbis = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param path path to the file (.ogg)
|
||||
* @throws Exception if the path is incorrect...
|
||||
*/
|
||||
public SoundBuffer(String path) throws Exception {
|
||||
this.bufferId = alGenBuffers();
|
||||
try (STBVorbisInfo info = STBVorbisInfo.malloc()) {
|
||||
ShortBuffer pcm = readVorbis(path, info);
|
||||
|
||||
// Equivalent de glBufferData pour openAl
|
||||
alBufferData(this.bufferId, info.channels() == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, pcm, info.sample_rate());
|
||||
}
|
||||
}
|
||||
|
||||
public int getBufferId() {
|
||||
return this.bufferId;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
alDeleteBuffers(this.bufferId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Source : https://github.com/lwjglgamedev/lwjglbook/blob/master/chapter28/src/main/java/org/lwjglb/engine/sound/SoundBuffer.java
|
||||
* lis un fichier .ogg et le convertis en .pcm seul format lisible par openAl
|
||||
* @param path chemin vers un fichier .ogg
|
||||
* @param info STBVorbisInfo
|
||||
* @return pcm
|
||||
* @throws Exception MemoryStack.stackPush()
|
||||
*/
|
||||
private ShortBuffer readVorbis(String path, STBVorbisInfo info) throws Exception {
|
||||
try (MemoryStack stack = MemoryStack.stackPush()) {
|
||||
this.vorbis = FileUtils.loadAsByteBuffer(path);
|
||||
IntBuffer error = stack.mallocInt(1);
|
||||
long decoder = stb_vorbis_open_memory(vorbis, error, null);
|
||||
if (decoder == NULL) {
|
||||
throw new RuntimeException("Failed to open Ogg Vorbis file. Error: " + error.get(0));
|
||||
} //Failed to open Ogg Vorbis file. Error: 30 / 34
|
||||
|
||||
stb_vorbis_get_info(decoder, info);
|
||||
|
||||
int channels = info.channels();
|
||||
|
||||
int lengthSamples = stb_vorbis_stream_length_in_samples(decoder);
|
||||
|
||||
pcm = MemoryUtil.memAllocShort(lengthSamples);
|
||||
|
||||
pcm.limit(stb_vorbis_get_samples_short_interleaved(decoder, channels, pcm) * channels);
|
||||
stb_vorbis_close(decoder);
|
||||
|
||||
return pcm;
|
||||
}
|
||||
}
|
||||
}
|
37
src/main/java/engine/sound/SoundListener.java
Normal file
@ -0,0 +1,37 @@
|
||||
package engine.sound;
|
||||
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import static org.lwjgl.openal.AL10.*;
|
||||
|
||||
public class SoundListener {
|
||||
|
||||
public SoundListener() {
|
||||
this(new Vector3f(0, 0, 0));
|
||||
}
|
||||
|
||||
public SoundListener(Vector3f position) {
|
||||
alListener3f(AL_POSITION, position.x, position.y, position.z);
|
||||
alListener3f(AL_VELOCITY, 0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
public void setSpeed(Vector3f speed) {
|
||||
alListener3f(AL_VELOCITY, speed.x, speed.y, speed.z);
|
||||
}
|
||||
|
||||
public void setPosition(Vector3f position) {
|
||||
alListener3f(AL_POSITION, position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
public void setOrientation(Vector3f at, Vector3f up) {
|
||||
float[] data = new float[6];
|
||||
data[0] = at.x;
|
||||
data[1] = at.y;
|
||||
data[2] = at.z;
|
||||
data[3] = up.x;
|
||||
data[4] = up.y;
|
||||
data[5] = up.z;
|
||||
alListenerfv(AL_ORIENTATION, data);
|
||||
}
|
||||
}
|
118
src/main/java/engine/sound/SoundManager.java
Normal file
@ -0,0 +1,118 @@
|
||||
// Source : https://github.com/lwjglgamedev/lwjglbook/blob/master/chapter28/src/main/java/org/lwjglb/engine/sound/SoundManager.java
|
||||
|
||||
package engine.sound;
|
||||
|
||||
import engine.math.Matrix4f;
|
||||
import engine.math.Vector3f;
|
||||
import org.lwjgl.openal.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.lwjgl.openal.AL10.*;
|
||||
import static org.lwjgl.openal.ALC10.*;
|
||||
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||
|
||||
|
||||
public class SoundManager {
|
||||
|
||||
private long device;
|
||||
|
||||
private long context;
|
||||
|
||||
private SoundListener listener;
|
||||
|
||||
private final List<SoundBuffer> soundBufferList;
|
||||
|
||||
private final Map<String, SoundSource> soundSourceMap;
|
||||
|
||||
private final Matrix4f cameraMatrix;
|
||||
|
||||
public SoundManager() {
|
||||
soundBufferList = new ArrayList<>();
|
||||
soundSourceMap = new HashMap<>();
|
||||
cameraMatrix = new Matrix4f();
|
||||
}
|
||||
|
||||
public void init() throws Exception {
|
||||
this.device = alcOpenDevice((ByteBuffer) null);
|
||||
if (device == NULL) {
|
||||
throw new IllegalStateException("Failed to open the default OpenAL device.");
|
||||
}
|
||||
ALCCapabilities deviceCaps = ALC.createCapabilities(device);
|
||||
this.context = alcCreateContext(device, (IntBuffer) null);
|
||||
if (context == NULL) {
|
||||
throw new IllegalStateException("Failed to create OpenAL context.");
|
||||
}
|
||||
alcMakeContextCurrent(context);
|
||||
AL.createCapabilities(deviceCaps);
|
||||
}
|
||||
|
||||
public void addSoundSource(String name, SoundSource soundSource) {
|
||||
this.soundSourceMap.put(name, soundSource);
|
||||
}
|
||||
|
||||
public SoundSource getSoundSource(String name) {
|
||||
return this.soundSourceMap.get(name);
|
||||
}
|
||||
|
||||
public void playSoundSource(String name) {
|
||||
SoundSource soundSource = this.soundSourceMap.get(name);
|
||||
if (soundSource != null && !soundSource.isPlaying()) {
|
||||
soundSource.play();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSoundSource(String name) {
|
||||
this.soundSourceMap.remove(name);
|
||||
}
|
||||
|
||||
public void addSoundBuffer(SoundBuffer soundBuffer) {
|
||||
this.soundBufferList.add(soundBuffer);
|
||||
}
|
||||
|
||||
public SoundListener getListener() {
|
||||
return this.listener;
|
||||
}
|
||||
|
||||
public void setListener(SoundListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
// Camera Statique de notre côté pas besoin de "corriger" cette fonction
|
||||
// public void updateListenerPosition(Camera camera) {
|
||||
// // Update camera matrix with camera data
|
||||
// Transformation.updateGenericViewMatrix(camera.getPosition(), camera.getRotation(), cameraMatrix);
|
||||
//
|
||||
// listener.setPosition(camera.getPosition());
|
||||
// Vector3f at = new Vector3f();
|
||||
// cameraMatrix.positiveZ(at).negate();
|
||||
// Vector3f up = new Vector3f();
|
||||
// cameraMatrix.positiveY(up);
|
||||
// listener.setOrientation(at, up);
|
||||
// }
|
||||
|
||||
public void setAttenuationModel(int model) {
|
||||
alDistanceModel(model);
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
for (SoundSource soundSource : soundSourceMap.values()) {
|
||||
soundSource.cleanup();
|
||||
}
|
||||
soundSourceMap.clear();
|
||||
for (SoundBuffer soundBuffer : soundBufferList) {
|
||||
soundBuffer.cleanup();
|
||||
}
|
||||
soundBufferList.clear();
|
||||
if (context != NULL) {
|
||||
alcDestroyContext(context);
|
||||
}
|
||||
if (device != NULL) {
|
||||
alcCloseDevice(device);
|
||||
}
|
||||
}
|
||||
}
|
62
src/main/java/engine/sound/SoundSource.java
Normal file
@ -0,0 +1,62 @@
|
||||
package engine.sound;
|
||||
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import static org.lwjgl.openal.AL10.*;
|
||||
|
||||
public class SoundSource {
|
||||
|
||||
private final int sourceId;
|
||||
|
||||
public SoundSource(boolean loop, boolean relative) {
|
||||
this.sourceId = alGenSources();
|
||||
if (loop) {
|
||||
alSourcei(sourceId, AL_LOOPING, AL_TRUE);
|
||||
}
|
||||
if (relative) {
|
||||
alSourcei(sourceId, AL_SOURCE_RELATIVE, AL_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBuffer(int bufferId) {
|
||||
stop();
|
||||
alSourcei(sourceId, AL_BUFFER, bufferId);
|
||||
}
|
||||
|
||||
public void setPosition(Vector3f position) {
|
||||
alSource3f(sourceId, AL_POSITION, position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
public void setSpeed(Vector3f speed) {
|
||||
alSource3f(sourceId, AL_VELOCITY, speed.x, speed.y, speed.z);
|
||||
}
|
||||
|
||||
public void setGain(float gain) {
|
||||
alSourcef(sourceId, AL_GAIN, gain);
|
||||
}
|
||||
|
||||
public void setProperty(int param, float value) {
|
||||
alSourcef(sourceId, param, value);
|
||||
}
|
||||
|
||||
public void play() {
|
||||
alSourcePlay(sourceId);
|
||||
}
|
||||
|
||||
public boolean isPlaying() {
|
||||
return alGetSourcei(sourceId, AL_SOURCE_STATE) == AL_PLAYING;
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
alSourcePause(sourceId);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
alSourceStop(sourceId);
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
stop();
|
||||
alDeleteSources(sourceId);
|
||||
}
|
||||
}
|
32
src/main/java/engine/utils/BufferUtilsEngine.java
Normal file
@ -0,0 +1,32 @@
|
||||
package engine.utils;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
public class BufferUtilsEngine {
|
||||
|
||||
private BufferUtilsEngine() {
|
||||
|
||||
}
|
||||
|
||||
public static ByteBuffer createByteBuffer(byte[] array){
|
||||
ByteBuffer result = ByteBuffer.allocateDirect(array.length).order(ByteOrder.nativeOrder());
|
||||
result.put(array).flip();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static FloatBuffer createFloatBuffer(float[] array){
|
||||
FloatBuffer result = ByteBuffer.allocateDirect(array.length << 2).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
||||
result.put(array).flip();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IntBuffer createIntBuffer(int[] array){
|
||||
IntBuffer result = ByteBuffer.allocateDirect(array.length << 2).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||
result.put(array).flip();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
49
src/main/java/engine/utils/FileUtils.java
Normal file
@ -0,0 +1,49 @@
|
||||
package engine.utils;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
||||
import engine.Engine;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SeekableByteChannel;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class FileUtils {
|
||||
|
||||
private FileUtils() {
|
||||
|
||||
}
|
||||
|
||||
public static String loadAsString(String file){
|
||||
StringBuilder result = new StringBuilder();
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(Engine.class.getResourceAsStream(file)));
|
||||
String buffer = "";
|
||||
while ((buffer = reader.readLine()) != null) {
|
||||
result.append(buffer).append("\n");
|
||||
}
|
||||
reader.close();
|
||||
} catch (IOException e){
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static ByteBuffer loadAsByteBuffer(String file) throws IOException{
|
||||
ByteBuffer buffer;
|
||||
|
||||
Path path = Paths.get(file);
|
||||
|
||||
try (SeekableByteChannel fc = Files.newByteChannel(path)) {
|
||||
buffer = BufferUtils.createByteBuffer((int) fc.size() + 1);
|
||||
while (fc.read(buffer) != -1) ;
|
||||
}
|
||||
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
}
|
60
src/main/java/engine/utils/ShaderUtils.java
Normal file
@ -0,0 +1,60 @@
|
||||
package engine.utils;
|
||||
|
||||
import engine.utils.FileUtils;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL20.*;
|
||||
|
||||
public class ShaderUtils {
|
||||
|
||||
private ShaderUtils(){
|
||||
|
||||
}
|
||||
|
||||
public static int load(String vertPath, String fragPath){
|
||||
String vert = FileUtils.loadAsString(vertPath);
|
||||
String frag = FileUtils.loadAsString(fragPath);
|
||||
return create(vert, frag);
|
||||
}
|
||||
|
||||
public static int create(String vert, String frag){
|
||||
// On crée et compile le vertex et le fragment shader
|
||||
int vertID = glCreateShader(GL_VERTEX_SHADER);
|
||||
int fragID = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(vertID, vert);
|
||||
glShaderSource(fragID, frag);
|
||||
|
||||
glCompileShader(vertID);
|
||||
if (glGetShaderi(vertID, GL_COMPILE_STATUS) == GL_FALSE){
|
||||
System.err.println("Failed to compile vertex shader");
|
||||
System.err.println(glGetShaderInfoLog(vertID));
|
||||
return -1;
|
||||
}
|
||||
|
||||
glCompileShader(fragID);
|
||||
if (glGetShaderi(fragID, GL_COMPILE_STATUS) == GL_FALSE){
|
||||
System.err.println("Failed to compile fragment shader");
|
||||
System.err.println(glGetShaderInfoLog(fragID));
|
||||
return -1;
|
||||
}
|
||||
//on lie les shaders au programme
|
||||
int program = glCreateProgram();
|
||||
glAttachShader(program, vertID);
|
||||
glAttachShader(program, fragID);
|
||||
glLinkProgram(program);
|
||||
|
||||
if(glGetProgrami(program, GL_LINK_STATUS) == GL_FALSE) {
|
||||
System.err.println("Failed to link vertex and fragment shader");
|
||||
System.err.println(glGetShaderInfoLog(program));
|
||||
return -1;
|
||||
}
|
||||
|
||||
glValidateProgram(program);
|
||||
|
||||
glDeleteShader(vertID);
|
||||
glDeleteShader(fragID);
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
}
|
1079
src/main/java/gameplay/Characters/Blue/BlueBaseFrames.java
Normal file
@ -0,0 +1,1079 @@
|
||||
package gameplay.Characters.Blue;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.Hitbox;
|
||||
import engine.object.ObjectGl;
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.hitboxes.*;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlueBaseFrames {
|
||||
|
||||
/*
|
||||
TO COPY PASTE FOR EASY frame function generation :
|
||||
|
||||
private static Frame ExampleFrame(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
*/
|
||||
private static Frame generateStandFrame1(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
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<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(0,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
private static Frame generateStandFrame2(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
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<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
protected static Frame[] blueStandFrames() {
|
||||
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;
|
||||
}
|
||||
|
||||
private static Frame generateCrouchFrame1(){
|
||||
//movement data
|
||||
double moveX = 0.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = true;
|
||||
boolean jumpC = true;
|
||||
boolean moveC = true;
|
||||
boolean dashC = true;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
protected static Frame[] blueCrouchFrames() {
|
||||
Frame[] cF = {generateCrouchFrame1()};
|
||||
return cF;
|
||||
}
|
||||
|
||||
private static Frame generateNeutralJumpFrame1(){
|
||||
//movement data
|
||||
double moveX = 0.0;
|
||||
double moveY = 18.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame generateNeutralJumpFrame2(){
|
||||
//movement data
|
||||
double moveX = 0.0;
|
||||
double moveY = -18.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame[] blueNeutralJump() {
|
||||
Frame[] jF = new Frame[39];
|
||||
for(int i = 0; i < 20; i++) {
|
||||
jF[i] = generateNeutralJumpFrame1();
|
||||
}
|
||||
for(int i = 20; i < jF.length; i++) {
|
||||
jF[i] = generateNeutralJumpFrame2();
|
||||
}
|
||||
return jF;
|
||||
}
|
||||
|
||||
private static Frame GenerateForwardJumpFrame1(){
|
||||
//movement data
|
||||
double moveX = 10.0;
|
||||
double moveY = 18.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame GenerateForwardJumpFrame2(){
|
||||
//movement data
|
||||
double moveX = 10.0;
|
||||
double moveY = 9.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame GenerateForwardJumpFrame3(){
|
||||
//movement data
|
||||
double moveX = 10.0;
|
||||
double moveY = -9.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame GenerateForwardJumpFrame4(){
|
||||
//movement data
|
||||
double moveX = 10.0;
|
||||
double moveY = -18.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame[] blueForwardJump() {
|
||||
Frame[] jF = new Frame[39];
|
||||
for(int i = 0; i < 10; i++) {
|
||||
jF[i] = GenerateForwardJumpFrame1();
|
||||
}
|
||||
for(int i = 10; i < 20; i++) {
|
||||
jF[i] = GenerateForwardJumpFrame2();
|
||||
}
|
||||
for(int i = 20; i < 30; i++) {
|
||||
jF[i] = GenerateForwardJumpFrame3();
|
||||
}
|
||||
for(int i = 30; i < jF.length; i++) {
|
||||
jF[i] = GenerateForwardJumpFrame4();
|
||||
}
|
||||
return jF;
|
||||
}
|
||||
|
||||
private static Frame BackJumpFrame1(){
|
||||
//movement data
|
||||
double moveX = -10.0;
|
||||
double moveY = 18.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame BackJumpFrame2(){
|
||||
//movement data
|
||||
double moveX = -10.0;
|
||||
double moveY = 9.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame BackJumpFrame3(){
|
||||
//movement data
|
||||
double moveX = -10.0;
|
||||
double moveY = -9.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame BackJumpFrame4(){
|
||||
//movement data
|
||||
double moveX = -10.0;
|
||||
double moveY = -18.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame[] blueBackJump() {
|
||||
Frame[] jF = new Frame[39];
|
||||
for(int i = 0; i < 10; i++) {
|
||||
jF[i] = BackJumpFrame1();
|
||||
}
|
||||
for(int i = 10; i < 20; i++) {
|
||||
jF[i] = BackJumpFrame2();
|
||||
}
|
||||
for(int i = 20; i < 30; i++) {
|
||||
jF[i] = BackJumpFrame3();
|
||||
}
|
||||
for(int i = 30; i < jF.length; i++) {
|
||||
jF[i] = BackJumpFrame4();
|
||||
}
|
||||
return jF;
|
||||
}
|
||||
|
||||
|
||||
private static Frame walkForwardFrame1(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
phb.add(bStandPHB2);
|
||||
phb.add(bStandPHB3);
|
||||
phb.add(bStandPHB4);
|
||||
pthb.add(bStandPTHB1);
|
||||
Frame blueStandframe1 = new Frame(0.0,8.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138*2,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
private static Frame walkForwardFrame2(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
phb.add(bStandPHB2);
|
||||
phb.add(bStandPHB3);
|
||||
phb.add(bStandPHB4);
|
||||
pthb.add(bStandPTHB1);
|
||||
Frame blueStandframe1 = new Frame(0.0,8.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138*3,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
private static Frame walkForwardFrame3(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
phb.add(bStandPHB2);
|
||||
phb.add(bStandPHB3);
|
||||
phb.add(bStandPHB4);
|
||||
pthb.add(bStandPTHB1);
|
||||
Frame blueStandframe1 = new Frame(0.0,8.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138*4,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
private static Frame walkForwardFrame4(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
phb.add(bStandPHB2);
|
||||
phb.add(bStandPHB3);
|
||||
phb.add(bStandPHB4);
|
||||
pthb.add(bStandPTHB1);
|
||||
Frame blueStandframe1 = new Frame(0.0,8.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138*5,0,138,138);
|
||||
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();
|
||||
f[1] = walkForwardFrame1();
|
||||
f[2] = walkForwardFrame1();
|
||||
f[3] = walkForwardFrame2();
|
||||
f[4] = walkForwardFrame2();
|
||||
f[5] = walkForwardFrame2();
|
||||
f[6] = walkForwardFrame3();
|
||||
f[7] = walkForwardFrame3();
|
||||
f[8] = walkForwardFrame3();
|
||||
f[9] = walkForwardFrame4();
|
||||
f[10] = walkForwardFrame4();
|
||||
f[11] = walkForwardFrame4();
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
private static Frame walkBackFrame4(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
phb.add(bStandPHB2);
|
||||
phb.add(bStandPHB3);
|
||||
phb.add(bStandPHB4);
|
||||
pthb.add(bStandPTHB1);
|
||||
Frame blueStandframe1 = new Frame(0.0,-8.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138*2,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
private static Frame walkBackFrame3(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
phb.add(bStandPHB2);
|
||||
phb.add(bStandPHB3);
|
||||
phb.add(bStandPHB4);
|
||||
pthb.add(bStandPTHB1);
|
||||
Frame blueStandframe1 = new Frame(0.0,-8.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138*3,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
private static Frame walkBackFrame2(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
phb.add(bStandPHB2);
|
||||
phb.add(bStandPHB3);
|
||||
phb.add(bStandPHB4);
|
||||
pthb.add(bStandPTHB1);
|
||||
Frame blueStandframe1 = new Frame(0.0,-8.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138*4,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
private static Frame walkBackFrame1(){
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
phb.add(bStandPHB2);
|
||||
phb.add(bStandPHB3);
|
||||
phb.add(bStandPHB4);
|
||||
pthb.add(bStandPTHB1);
|
||||
Frame blueStandframe1 = new Frame(0.0,-8.0,phb,new ArrayList<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,true,true,true,true,true);
|
||||
blueStandframe1.setSpriteWrap(138*5,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
protected static Frame[] blueBWalk() {
|
||||
Frame[] f = new Frame[4];
|
||||
f[0] = walkBackFrame1();
|
||||
f[1] = walkBackFrame2();
|
||||
f[2] = walkBackFrame3();
|
||||
f[3] = walkBackFrame4();
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame KnockedDown1() {
|
||||
//movement data
|
||||
double moveX = -16.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(300,-450,200,300);
|
||||
|
||||
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 = -16.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(300,-450,200,300);
|
||||
|
||||
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 = -16.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(300,-450,200,300);
|
||||
|
||||
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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(300,-450,200,300);
|
||||
|
||||
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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(300,-450,200,300);
|
||||
|
||||
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 = -8.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(300,-450,200,300);
|
||||
|
||||
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 = -8.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(300,-450,200,300);
|
||||
|
||||
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 = -8.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(300,-450,200,300);
|
||||
|
||||
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, false, new Vector3f(4.0f, 3.0f));
|
||||
engine.init();
|
||||
|
||||
Vector3f BLUE = new Vector3f(0f,0f,1f); //passive_hit
|
||||
Vector3f RED = new Vector3f(1f,0f,0f); //active_hit
|
||||
Vector3f GREEN = new Vector3f(0f,1f,0f); //passive_throw
|
||||
Vector3f YELLOW = new Vector3f(1f,1f,0f); //Active throw
|
||||
Vector3f PURPLE = new Vector3f(1f,0f,1f); //pushbox
|
||||
|
||||
|
||||
String path = "textures/Sprite_sans_grille_9comp.png";
|
||||
String pathToBG = "textures/arena1.png";
|
||||
|
||||
Frame f = BlueMisc.airHit();
|
||||
|
||||
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;
|
||||
int posY = 200;
|
||||
|
||||
blue.translate(new Vector3f(posX,posY,0));
|
||||
|
||||
engine.add_objectGl(blue);
|
||||
float posZ = 11f;
|
||||
|
||||
for(Passive_HitBox h: f.getPassHitBox()){
|
||||
Hitbox hh = new Hitbox(posZ,h.getSize_x(),h.getSize_y(),1f,BLUE);
|
||||
engine.add_objectGl(hh);
|
||||
hh.translate(new Vector3f(posX+h.getPosX(),posY+h.getPosY()));
|
||||
posZ++;
|
||||
}
|
||||
for(Active_HitBox h: f.getActHitBox()){
|
||||
Hitbox hh = new Hitbox(posZ,h.getSize_x(),h.getSize_y(),1f,RED);
|
||||
engine.add_objectGl(hh);
|
||||
hh.translate(new Vector3f(posX+h.getPosX(),posY+h.getPosY()));
|
||||
posZ++;
|
||||
}
|
||||
for(Passive_throw_HitBox h: f.getPassThrowHitBox()){
|
||||
Hitbox hh = new Hitbox(posZ,h.getSize_x(),h.getSize_y(),1f,GREEN);
|
||||
engine.add_objectGl(hh);
|
||||
hh.translate(new Vector3f(posX+h.getPosX(),posY+h.getPosY()));
|
||||
posZ++;
|
||||
}
|
||||
for(Active_throw_Hitbox h: f.getActThrowHitBox()){
|
||||
Hitbox hh = new Hitbox(posZ,h.getSize_x(),h.getSize_y(),1f,YELLOW);
|
||||
engine.add_objectGl(hh);
|
||||
hh.translate(new Vector3f(posX+h.getPosX(),posY+h.getPosY()));
|
||||
posZ++;
|
||||
}
|
||||
|
||||
Push_HitBox phb = f.getPushHitBox();
|
||||
Hitbox hh = new Hitbox(posZ,phb.getSize_x(),phb.getSize_y(),1f,PURPLE);
|
||||
engine.add_objectGl(hh);
|
||||
hh.translate(new Vector3f(posX+phb.getPosX(),posY+phb.getPosY()));
|
||||
|
||||
engine.update();
|
||||
engine.render();
|
||||
|
||||
double ts1 = System.currentTimeMillis();
|
||||
double ts2 = System.currentTimeMillis();
|
||||
while(ts2 - ts1 < 60000) {
|
||||
ts2 = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
486
src/main/java/gameplay/Characters/Blue/BlueMisc.java
Normal file
@ -0,0 +1,486 @@
|
||||
package gameplay.Characters.Blue;
|
||||
|
||||
import gameplay.actions.Attack;
|
||||
import gameplay.actions.attackPart;
|
||||
import gameplay.entities.Status;
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.hitboxes.*;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class BlueMisc {
|
||||
private static Frame fDash1() {
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,false,false,false,false);
|
||||
f.setSpriteWrap(14*138,139,138,138); // A 138 on voit les iepds du boug au dessus
|
||||
return f;
|
||||
}
|
||||
private static Frame fDash2() {
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,12.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(14*138,139,138,138);
|
||||
return f;
|
||||
}
|
||||
private static Frame fDash3() {
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,6.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,true,false,false);
|
||||
f.setSpriteWrap(14*138,139,138,138);
|
||||
return f;
|
||||
}
|
||||
private static Frame fDash4() {
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,false,true,false,false);
|
||||
f.setSpriteWrap(14*138,139,138,138);
|
||||
return f;
|
||||
}
|
||||
protected static Frame[] blueFDash() {
|
||||
Frame[] f = new Frame[21];
|
||||
int c = 0;
|
||||
while(c < 3) {f[c] = fDash1(); c++;}
|
||||
while(c < 11) {f[c] = fDash2(); c++;}
|
||||
while(c < 14) {f[c] = fDash3(); c++;}
|
||||
while(c < f.length) {f[c] = fDash4(); c++;}
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame bDash1() {
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,false,false,false,false);
|
||||
f.setSpriteWrap(14*138,139,138,138);
|
||||
return f;
|
||||
}
|
||||
private static Frame bDash2() {
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,-12.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(14*138,139,138,138);
|
||||
return f;
|
||||
}
|
||||
private static Frame bDash3() {
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,-6.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(14*138,139,138,138);
|
||||
return f;
|
||||
}
|
||||
private static Frame bDash4() {
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,false,false,false,false);
|
||||
f.setSpriteWrap(14*138,139,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame[] blueBDash() {
|
||||
Frame[] f = new Frame[21];
|
||||
int c = 0;
|
||||
while(c < 3) {f[c] = bDash1(); c++;}
|
||||
while(c < 11) {f[c] = bDash2(); c++;}
|
||||
while(c < 14) {f[c] = bDash3(); c++;}
|
||||
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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
protected static Frame airHit(){
|
||||
//movement data
|
||||
double moveX = 12.0;
|
||||
double moveY = 8.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(200,-400,300,250);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(250,-490,280,170);
|
||||
Passive_HitBox phb2 = new Passive_HitBox(200,-380,280,170);
|
||||
|
||||
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(0,138*6,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame falling(){
|
||||
//movement data
|
||||
double moveX = 12.0;
|
||||
double moveY = -8.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(100,-500,400,150);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(80,-490,440,170);
|
||||
|
||||
phb.add(phb1);
|
||||
|
||||
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*4,138,138);
|
||||
return f;
|
||||
}
|
||||
}
|
2273
src/main/java/gameplay/Characters/Blue/BlueNormals.java
Normal file
@ -0,0 +1,2273 @@
|
||||
package gameplay.Characters.Blue;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.Hitbox;
|
||||
import engine.object.ObjectGl;
|
||||
import gameplay.actions.Attack;
|
||||
import gameplay.actions.attackPart;
|
||||
import gameplay.entities.Status;
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.hitboxes.*;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static gameplay.input.ButtonIG.*;
|
||||
|
||||
|
||||
public class BlueNormals {
|
||||
protected static Frame crouchAFrame1(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
protected static Frame crouchAFrame2(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
protected static Frame crouchAFrame3(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
protected static attackPart blueCrouchAstartup() {
|
||||
Frame[] f = new Frame[4];
|
||||
f[0] = crouchAFrame1();
|
||||
f[1] = crouchAFrame1();
|
||||
f[2] = crouchAFrame1();
|
||||
f[3] = crouchAFrame1();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueCrouchArecovery() {
|
||||
Frame[] f = new Frame[5];
|
||||
f[0] = crouchAFrame3();
|
||||
f[1] = crouchAFrame3();
|
||||
f[2] = crouchAFrame3();
|
||||
f[3] = crouchAFrame3();
|
||||
f[4] = crouchAFrame3();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueCrouchAactive() {
|
||||
Frame[] f = new Frame[3];
|
||||
f[0] = crouchAFrame2();
|
||||
f[1] = crouchAFrame2();
|
||||
f[2] = crouchAFrame2();
|
||||
return(new attackPart(10,0,4,4,8,3,f,false,false,false));
|
||||
}
|
||||
|
||||
protected static Attack blueCrouchJab() {
|
||||
ButtonIG[][] cmd = {{DOWN,A}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueCrouchAstartup(),blueCrouchAactive(),blueCrouchArecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame crouchCFrame1() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
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);
|
||||
Active_HitBox ahb1 = new Active_HitBox(400,0,90,300);
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
phb.add(bStandPHB1);
|
||||
pthb.add(bStandPTHB1);
|
||||
ahb.add(ahb1);
|
||||
Frame f = new Frame(0.0,0.0,phb,ahb,pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,false,false,false,false,false);
|
||||
f.setSpriteWrap((138*8),(138*2),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame crouchCFrame4() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
protected static Frame crouchCFrame5() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
protected static attackPart blueCrouchCstartup() {
|
||||
Frame[] f = new Frame[5];
|
||||
f[0] = crouchCFrame1();
|
||||
f[1] = crouchCFrame1();
|
||||
f[2] = crouchCFrame2();
|
||||
f[3] = crouchCFrame2();
|
||||
f[4] = crouchCFrame2();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueCrouchCrecovery() {
|
||||
Frame[] f = new Frame[19];
|
||||
int i;
|
||||
for(i = 0; i < 10; i++) {
|
||||
f[i] = crouchCFrame4();
|
||||
}
|
||||
for(int j = i; j < f.length; j++) {
|
||||
f[j] = crouchCFrame5();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueCrouchCactive() {
|
||||
Frame[] f = new Frame[5];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = crouchCFrame3();
|
||||
}
|
||||
return(new attackPart(45,0,13,29,12,5,f,false,false,false));
|
||||
}
|
||||
|
||||
protected static Attack blueCrouchFierce() {
|
||||
ButtonIG[][] cmd = {{DOWN,C}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueCrouchCstartup(),blueCrouchCactive(),blueCrouchCrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame crouchBFrame1() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = 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(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap(0,138*2,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame crouchBFrame2() {
|
||||
//movement data
|
||||
double moveX = 8.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = 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);
|
||||
Active_HitBox ahb1 = new Active_HitBox(400,-580,200,100);
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
ahb.add(ahb1);
|
||||
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;
|
||||
}
|
||||
|
||||
protected static Frame crouchBFrame3() {
|
||||
//movement data
|
||||
double moveX = 8.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = 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(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap(0,138*2,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static attackPart blueCrouchBstartup() {
|
||||
Frame[] f = new Frame[3];
|
||||
f[0] = crouchBFrame1();
|
||||
f[1] = crouchBFrame1();
|
||||
f[2] = crouchBFrame1();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueCrouchBrecovery() {
|
||||
Frame[] f = new Frame[4];
|
||||
f[0] = crouchBFrame3();
|
||||
f[1] = crouchBFrame3();
|
||||
f[2] = crouchBFrame3();
|
||||
f[3] = crouchBFrame3();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueCrouchBactive() {
|
||||
Frame[] f = new Frame[4];
|
||||
f[0] = crouchBFrame2();
|
||||
f[1] = crouchBFrame2();
|
||||
f[2] = crouchBFrame2();
|
||||
f[3] = crouchBFrame2();
|
||||
return(new attackPart(10,0,9,8,10,5,f,false,false,false));
|
||||
}
|
||||
|
||||
protected static Attack blueCrouchShort() {
|
||||
ButtonIG[][] cmd = {{DOWN,B}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueCrouchBstartup(),blueCrouchBactive(),blueCrouchBrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame crouchDFrame1() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = 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(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*5),(138*7),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame crouchDFrame2() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(120,-250*1.25f,250,300*1.25f);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(100,-250*1.25f,200*1.25f,300*1.25f);
|
||||
Passive_HitBox phb2 = new Passive_HitBox(260*1.25f,-550,300,100);
|
||||
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(300,-500,400,200);
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
ahb.add(ahb1);
|
||||
|
||||
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*7),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame crouchDFrame3() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = 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(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*7),(138*7),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame crouchDFrame4() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(140*1.25f,-250*1.25f,280*1.25f,300*1.25f);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(100*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(100*1.25f,-500*1.25f,300*1.25f,70*1.25f);
|
||||
pB1.reverseHorizontally();
|
||||
phb1.reverseHorizontally();
|
||||
phb2.reverseHorizontally();
|
||||
pthb1.reverseHorizontally();
|
||||
pthb.add(pthb1);
|
||||
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*8),(138*7),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static attackPart blueCrouchDstartup() {
|
||||
Frame[] f = new Frame[4];
|
||||
f[0] = crouchDFrame1();
|
||||
f[1] = crouchDFrame1();
|
||||
f[2] = crouchDFrame1();
|
||||
f[3] = crouchDFrame1();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueCrouchDrecovery() {
|
||||
Frame[] f = new Frame[25];
|
||||
for(int i = 0; i < 15; i++) {
|
||||
f[i] = crouchDFrame3();
|
||||
}
|
||||
for(int i = 15; i < f.length; i++) {
|
||||
f[i] = crouchDFrame4();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueCrouchDactive() {
|
||||
Frame[] f = new Frame[6];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = crouchDFrame2();
|
||||
}
|
||||
return(new attackPart(70,0,31,10,30,15,f,true,false,true));
|
||||
}
|
||||
|
||||
protected static Attack blueCrouchRoundHouse() {
|
||||
ButtonIG[][] cmd = {{DOWN,D}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueCrouchDstartup(),blueCrouchDactive(),blueCrouchDrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame standAFrame1(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
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,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap((138*3),0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame standAFrame2(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
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,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap((138*13),0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
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);
|
||||
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<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
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<Active_HitBox>(),pthb,new ArrayList<Active_throw_Hitbox>(),
|
||||
bStandPB1,false,false,false,false,false);
|
||||
blueStandframe1.setSpriteWrap(138,0,138,138);
|
||||
return blueStandframe1;
|
||||
}
|
||||
|
||||
protected static attackPart blueStandAstartup() {
|
||||
Frame[] f = new Frame[3];
|
||||
f[0] = standAFrame1();
|
||||
f[1] = standAFrame1();
|
||||
f[2] = standAFrame1();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueStandArecovery() {
|
||||
Frame[] f = new Frame[5];
|
||||
f[0] = standAFrame3();
|
||||
f[1] = standAFrame3();
|
||||
f[2] = standAFrame3();
|
||||
f[3] = standAFrame3();
|
||||
f[4] = standAFrame3();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueStandAactive() {
|
||||
Frame[] f = new Frame[3];
|
||||
f[0] = standAFrame2();
|
||||
f[1] = standAFrame2();
|
||||
f[2] = standAFrame2();
|
||||
return(new attackPart(50,0,4,4,8,3,f,false,false,false));
|
||||
}
|
||||
|
||||
protected static Attack blueStandJab() {
|
||||
ButtonIG[][] cmd = {{A}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueStandAstartup(),blueStandAactive(),blueStandArecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame StandCFrame1() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
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 f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pushb,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap(0,0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame StandCFrame2() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-150*1.25f,200*1.25f,180*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,-350*1.25f,200*1.25f,200*1.25f);
|
||||
Passive_HitBox phb4 = new Passive_HitBox(250*1.25f,-120*1.25f,70*1.25f,80*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 f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pushb,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*2),(138*3),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame StandCFrame3() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
Passive_HitBox phb1 = new Passive_HitBox(200*1.25f,-150*1.25f,200*1.25f,200*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,-350*1.25f,170*1.25f,200*1.25f);
|
||||
Passive_HitBox phb4 = new Passive_HitBox(250*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,250*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(350,-220,250,130);
|
||||
/*
|
||||
adding hitboxes to lists
|
||||
*/
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
phb.add(phb3);
|
||||
phb.add(phb4);
|
||||
pthb.add(pthb1);
|
||||
ahb.add(ahb1);
|
||||
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pushb,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap(138*6,138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame StandCFrame4() {
|
||||
//movement data
|
||||
double moveX = 0.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = true;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
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 f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pushb,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap(138,(138*7),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static attackPart blueStandCstartup() {
|
||||
Frame[] f = new Frame[6];
|
||||
for(int i = 0; i < 3; i++) {
|
||||
f[i] = StandCFrame1();
|
||||
}
|
||||
for(int i = 3; i < 6; i++) {
|
||||
f[i] = StandCFrame2();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueStandCrecovery() {
|
||||
Frame[] f = new Frame[22];
|
||||
for(int i = 0; i < 22; i++) {
|
||||
f[i] = StandCFrame4();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueStandCactive() {
|
||||
Frame[] f = new Frame[6];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = StandCFrame3();
|
||||
}
|
||||
return(new attackPart(60,0,28,14,10,5,f,false,false,false));
|
||||
}
|
||||
|
||||
protected static Attack blueStandFierce() {
|
||||
ButtonIG[][] cmd = {{C}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueStandCstartup(),blueStandCactive(),blueStandCrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame standDFrame1(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
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(pHB4);
|
||||
phb.add(pHB3);
|
||||
phb.add(pHB2);
|
||||
pthb.add(pthb1);
|
||||
|
||||
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(0.0,3.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap((138*4),0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame standDFrame2(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
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(pHB4);
|
||||
phb.add(pHB3);
|
||||
phb.add(pHB2);
|
||||
phb.add(pHB5);
|
||||
phb.add(pHB6);
|
||||
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,false,false,false,false);
|
||||
f.setSpriteWrap((138*10),138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame standDFrame3(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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*9),138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame standDFrame4(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
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(pHB4);
|
||||
phb.add(pHB3);
|
||||
phb.add(pHB2);
|
||||
phb.add(pHB5);
|
||||
phb.add(pHB6);
|
||||
pthb.add(pthb1);
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(0.0,3.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap((138*10),138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static Frame standDFrame5(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
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,3.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap((138*4),0,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static attackPart blueStandDstartup() {
|
||||
Frame[] f = new Frame[8];
|
||||
for(int i = 0; i < 5; i++) {
|
||||
f[i] = standDFrame1();
|
||||
}
|
||||
for(int i = 5; i< f.length; i++) {
|
||||
f[i] = standDFrame2();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueStandDactive() {
|
||||
Frame[] f = new Frame[5];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = standDFrame3();
|
||||
}
|
||||
return(new attackPart(70,0,20,18,16,14,f,false,false,false));
|
||||
}
|
||||
|
||||
protected static attackPart blueStandDrecovery() {
|
||||
Frame[] f = new Frame[18];
|
||||
for(int i = 0; i < 10; i++) {
|
||||
f[i] = standDFrame4();
|
||||
}
|
||||
for(int i = 10; i < f.length; i++) {
|
||||
f[i] = standDFrame5();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static Attack blueStandHeavyKick() {
|
||||
ButtonIG[][] cmd = {{D}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueStandDstartup(),blueStandDactive(),blueStandDrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame StandBFrame1() {
|
||||
//movement data
|
||||
double moveX = 3.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
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 bStandPB1 = 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 f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*5),(138*5),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame StandBFrame2() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
Passive_HitBox phb1 = new Passive_HitBox(130*1.25f,-200*1.25f,150*1.25f,150*1.25f);
|
||||
Passive_HitBox phb2 = new Passive_HitBox(150*1.25f,-300*1.25f,100*1.25f,150*1.25f);
|
||||
Passive_HitBox phb3 = new Passive_HitBox(160*1.25f,-400*1.25f,150*1.25f,150*1.25f);
|
||||
Passive_HitBox phb4 = new Passive_HitBox(220*1.25f,-150*1.25f,50*1.25f,50*1.25f);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(120*1.25f,-500*1.25f,220*1.25f,70*1.25f);
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(160*1.25f,-150*1.25f,160*1.25f,400*1.25f);
|
||||
Active_HitBox ahb1= new Active_HitBox(350,-350,150,220);
|
||||
/*
|
||||
adding hitboxes to lists
|
||||
*/
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
phb.add(phb3);
|
||||
phb.add(phb4);
|
||||
pthb.add(pthb1);
|
||||
ahb.add(ahb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*6),(138*5),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame StandBFrame3() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
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 bStandPB1 = 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 f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*7),(138*5),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static attackPart blueStandBstartup() {
|
||||
Frame[] f = new Frame[6];
|
||||
for(int i = 0; i < 6; i++) {
|
||||
f[i] = StandBFrame1();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueStandBactive() {
|
||||
Frame[] f = new Frame[6];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = StandBFrame2();
|
||||
}
|
||||
return(new attackPart(50,0,11,8,8,5,f,false,false,false));
|
||||
}
|
||||
|
||||
private static attackPart blueStandBrecovery() {
|
||||
Frame[] f = new Frame[4];
|
||||
for(int i = 0; i < 4; i++) {
|
||||
f[i] = StandBFrame3();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static Attack blueStandShort() {
|
||||
ButtonIG[][] cmd = {{B}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueStandBstartup(),blueStandBactive(),blueStandBrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected static Frame ForwardDFrame0() {
|
||||
//movement data
|
||||
double moveX = 3.0;
|
||||
double moveY = 0.0;
|
||||
|
||||
//cancelData
|
||||
boolean normalC = false;
|
||||
boolean specialC = false;
|
||||
boolean jumpC = false;
|
||||
boolean moveC = false;
|
||||
boolean dashC = false;
|
||||
|
||||
//hitbox lists
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(200,-100,250,550);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(200,-600,250,120);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(230, -100, 200, 550);
|
||||
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*5),(138*4),138,138);
|
||||
return f;
|
||||
}
|
||||
protected static Frame ForwardDFrame1(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(200,-100,250,550);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(200,-600,250,120);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(230, -100, 200, 550);
|
||||
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*5),(138*4),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame ForwardDFrame2(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(200,-100,250,550);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(200,-600,250,120);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(230, -100, 200, 550);
|
||||
Passive_HitBox phb2 = new Passive_HitBox(400, -200, 200, 170);
|
||||
|
||||
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*10),138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame ForwardDFrame3(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(200,-100,180,550);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(200,-600,250,120);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(200,-100,180,550);
|
||||
Active_HitBox ahb1 = new Active_HitBox(300,-60,250,300);
|
||||
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
ahb.add(ahb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*11),138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame ForwardDFrame4(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(200,-100,180,550);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(200,-600,250,120);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(200,-100,180,550);
|
||||
Active_HitBox ahb1 = new Active_HitBox(300,-160,250,300);
|
||||
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
ahb.add(ahb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*12),138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame ForwardDFrame6(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(200,-100,180,550);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(200,-600,250,120);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(200,-100,180,550);
|
||||
Passive_HitBox ahb1 = new Passive_HitBox(300,-160,250,300);
|
||||
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
phb.add(ahb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*12),138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame ForwardDFrame5(){
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(200,-100,250,550);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(200,-600,250,120);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(230, -100, 200, 550);
|
||||
|
||||
pthb.add(pthb1);
|
||||
phb.add(phb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*5),(138*4),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static attackPart blueForwardDstartup() {
|
||||
Frame[] f = new Frame[18];
|
||||
for (int i = 0; i < 3 ; i++) {
|
||||
f[i] = ForwardDFrame0();
|
||||
}
|
||||
for (int i = 3; i < 10; i++) {
|
||||
f[i] = ForwardDFrame1();
|
||||
}
|
||||
for (int i = 10; i < f.length; i++) {
|
||||
f[i] = ForwardDFrame2();
|
||||
}
|
||||
return (new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueForwardDrecovery() {
|
||||
Frame[] f = new Frame[8];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
f[i] = ForwardDFrame6();
|
||||
}
|
||||
for (int i = 3; i < f.length; i++) {
|
||||
f[i] = ForwardDFrame5();
|
||||
}
|
||||
return (new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart blueForwardDactive() {
|
||||
Frame[] f = new Frame[4];
|
||||
for (int i = 0; i < f.length; i++) {
|
||||
f[i] = ForwardDFrame3();
|
||||
}
|
||||
return(new attackPart(20,0,5,5,0,0,f,false,true,false));
|
||||
}
|
||||
|
||||
protected static attackPart blueForwardDactive2() {
|
||||
Frame[] f = new Frame[3];
|
||||
for (int i = 0; i < f.length; i++) {
|
||||
f[i] = ForwardDFrame4();
|
||||
}
|
||||
return(new attackPart(60,0,11,3,8.0,4.0,f,false,true,false));
|
||||
}
|
||||
|
||||
protected static Attack blueFordwardRoundHouse() {
|
||||
ButtonIG[][] cmd = {{FORWARD,D}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {blueForwardDstartup(),blueForwardDactive(),blueForwardDactive2(),blueForwardDrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame JumpAFrame1() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*12),(138*3),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame JumpAFrame2() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
Push_HitBox pB1 = new Push_HitBox(200*1.25f,-150,160*1.25f,350);
|
||||
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 phb5 = new Passive_HitBox(280*1.25f,-280,200,80);
|
||||
Active_HitBox ahb1 = new Active_HitBox(420,-250,120,120);
|
||||
Active_HitBox ahb2 = new Active_HitBox(520,-330,120,120);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
phb.add(phb3);
|
||||
phb.add(phb5);
|
||||
ahb.add(ahb1);
|
||||
ahb.add(ahb2);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*13),(138*3),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame JumpAFrame3() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
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,-150*1.25f,170*1.25f,200*1.25f);
|
||||
Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-400*1.25f,90*1.25f,80*1.25f);
|
||||
Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-250*1.25f,140*1.25f,160*1.25f);
|
||||
Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-100*1.25f,70*1.25f,50*1.25f);
|
||||
Passive_HitBox phb5 = new Passive_HitBox(280*1.25f,-70*1.25f,70*1.25f,100*1.25f);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
phb.add(phb3);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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*3),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static attackPart blueJumpAstartup() {
|
||||
Frame[] f = new Frame[3];
|
||||
for(int i = 0; i < 3; i++) {
|
||||
f[i] = JumpAFrame1();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueJumpAactive() {
|
||||
Frame[] f = new Frame[4];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpAFrame2();
|
||||
}
|
||||
return(new attackPart(60,0,10,5,8,3,f,false,true,false));
|
||||
}
|
||||
|
||||
private static attackPart blueJumpArecovery() {
|
||||
Frame[] f = new Frame[5];
|
||||
for(int i = 0; i < 5; i++) {
|
||||
f[i] = JumpAFrame3();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static Attack blueJumpJab() {
|
||||
ButtonIG[][] cmd = {{A}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.JUMPING;
|
||||
attackPart[] parts = {blueJumpAstartup(),blueJumpAactive(),blueJumpArecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame JumpCFrame1() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*12),(138*3),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame JumpCFrame2() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox pB1 = new Push_HitBox(200*1.25f,-150,160*1.25f,350);
|
||||
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 phb5 = new Passive_HitBox(280*1.25f,-280,200,80);
|
||||
Active_HitBox ahb1 = new Active_HitBox(420,-250,120,120);
|
||||
Active_HitBox ahb2 = new Active_HitBox(520,-330,120,120);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
phb.add(phb3);
|
||||
phb.add(phb5);
|
||||
ahb.add(ahb1);
|
||||
ahb.add(ahb2);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*13),(138*3),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame JumpCFrame3() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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,-150*1.25f,170*1.25f,200*1.25f);
|
||||
Passive_HitBox phb2 = new Passive_HitBox(210*1.25f,-400*1.25f,90*1.25f,80*1.25f);
|
||||
Passive_HitBox phb3 = new Passive_HitBox(230*1.25f,-250*1.25f,140*1.25f,160*1.25f);
|
||||
Passive_HitBox phb4 = new Passive_HitBox(230*1.25f,-100*1.25f,70*1.25f,50*1.25f);
|
||||
Passive_HitBox phb5 = new Passive_HitBox(280*1.25f,-70*1.25f,70*1.25f,100*1.25f);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
phb.add(phb3);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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*3),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static attackPart blueJumpCstartup() {
|
||||
Frame[] f = new Frame[4];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpCFrame1();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueJumpCactive() {
|
||||
Frame[] f = new Frame[8];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpCFrame2();
|
||||
}
|
||||
return(new attackPart(60,0,30,5,13,5,f,false,true,false));
|
||||
}
|
||||
|
||||
private static attackPart blueJumpCrecovery() {
|
||||
Frame[] f = new Frame[15];
|
||||
for(int i = 0; i < 15; i++) {
|
||||
f[i] = JumpCFrame3();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static Attack blueJumpFierce() {
|
||||
ButtonIG[][] cmd = {{C}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.JUMPING;
|
||||
attackPart[] parts = {blueJumpCstartup(),blueJumpCactive(),blueJumpCrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame JumpBFrame1() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame JumpBFrame2() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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,-250,230,100);
|
||||
Active_HitBox ahb1 = new Active_HitBox(360,-240,200,120);
|
||||
Active_HitBox ahb2 = new Active_HitBox(530,-200,120,120);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
phb.add(phb3);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
ahb.add(ahb1);
|
||||
ahb.add(ahb2);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,pB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*13),138,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame JumpBFrame3() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
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);
|
||||
phb.add(phb4);
|
||||
phb.add(phb5);
|
||||
|
||||
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,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static attackPart blueJumpBstartup() {
|
||||
Frame[] f = new Frame[3];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpBFrame1();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueJumpBactive() {
|
||||
Frame[] f = new Frame[40];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpBFrame2();
|
||||
}
|
||||
return(new attackPart(60,0,30,15,25,10,f,false,true,false));
|
||||
}
|
||||
|
||||
private static attackPart blueJumpBrecovery() {
|
||||
Frame[] f = new Frame[6];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpBFrame3();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static Attack blueJumpShort() {
|
||||
ButtonIG[][] cmd = {{B}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.JUMPING;
|
||||
attackPart[] parts = {blueJumpBstartup(),blueJumpBactive(),blueJumpBrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
protected static Frame JumpDFrame1() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(250,-50,150,400);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(240,-50,170,430);
|
||||
|
||||
phb.add(phb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*11),(138*6),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame JumpDFrame2() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(250,-50,150,400);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(240,-50,170,430);
|
||||
Passive_HitBox phb2 = new Passive_HitBox(330,-240,220,100);
|
||||
|
||||
Active_HitBox ahb1 = new Active_HitBox(330,-230,280,150);
|
||||
phb.add(phb1);
|
||||
phb.add(phb2);
|
||||
ahb.add(ahb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*10),(138*6),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame JumpDFrame3() {
|
||||
//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<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
|
||||
//generate hitboxes here and then use ArrayList add method to add them to the correct list
|
||||
Push_HitBox bStandPB1 = new Push_HitBox(250,-50,150,400);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(240,-50,170,430);
|
||||
|
||||
phb.add(phb1);
|
||||
|
||||
Frame f = new Frame(moveY,moveX,phb,ahb,pthb,athb,bStandPB1,normalC,specialC,jumpC,moveC,dashC);
|
||||
|
||||
//set sprite data on sheet
|
||||
f.setSpriteWrap((138*11),(138*6),138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
private static attackPart blueJumpDstartup() {
|
||||
Frame[] f = new Frame[4];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpDFrame1();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
private static attackPart blueJumpDactive() {
|
||||
Frame[] f = new Frame[8];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpDFrame2();
|
||||
}
|
||||
return(new attackPart(90,0,50,20,45,15,f,false,true,false));
|
||||
}
|
||||
|
||||
private static attackPart blueJumpDrecovery() {
|
||||
Frame[] f = new Frame[36];
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
f[i] = JumpDFrame3();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static Attack blueJumpRoundHouse() {
|
||||
ButtonIG[][] cmd = {{D}};
|
||||
boolean isSpecial = false;
|
||||
Status rS = Status.JUMPING;
|
||||
attackPart[] parts = {blueJumpDstartup(),blueJumpDactive(),blueJumpDrecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
}
|
228
src/main/java/gameplay/Characters/Blue/BlueSpecials.java
Normal file
@ -0,0 +1,228 @@
|
||||
package gameplay.Characters.Blue;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.Hitbox;
|
||||
import engine.object.ObjectGl;
|
||||
import gameplay.actions.Attack;
|
||||
import gameplay.actions.attackPart;
|
||||
import gameplay.entities.Status;
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.hitboxes.*;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static gameplay.input.ButtonIG.*;
|
||||
|
||||
public class BlueSpecials {
|
||||
protected static Frame lDPFrame1(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
//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);
|
||||
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(0,138*5,138,138);
|
||||
return f;
|
||||
}
|
||||
protected static Frame lDPFrame2(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
//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);
|
||||
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(0.0,0.0,phb,ahb,pthb,athb,pB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(138*7,138*2,138,138);
|
||||
return f;
|
||||
}
|
||||
protected static Frame lDPFrame3(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
Push_HitBox pushB = new Push_HitBox(250,-70,150,500);
|
||||
Active_HitBox ahb1 = new Active_HitBox(350,-0,150,500);
|
||||
|
||||
ahb.add(ahb1);
|
||||
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(25.0,12.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(138*2,138*5,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame lDPFrame4(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
Push_HitBox pushB = new Push_HitBox(250,-70,150,500);
|
||||
Active_HitBox ahb1 = new Active_HitBox(350,-0,150,500);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(250,-70,150,500);
|
||||
ahb.add(ahb1);
|
||||
|
||||
/*
|
||||
adding hitboxes to lists
|
||||
*/
|
||||
phb.add(phb1);
|
||||
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(25.0,0.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(138*2,138*5,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame lDPFrame5(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
Push_HitBox pushB = new Push_HitBox(250,-70,150,500);
|
||||
Passive_HitBox phb1 = new Passive_HitBox(250,-70,250,550);
|
||||
|
||||
/*
|
||||
adding hitboxes to lists
|
||||
*/
|
||||
phb.add(phb1);
|
||||
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(-25.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,138*5,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static Frame lDPFrame6(){
|
||||
|
||||
/*
|
||||
Hitboxes lists creation
|
||||
*/
|
||||
ArrayList<Passive_HitBox> phb = new ArrayList<Passive_HitBox>();
|
||||
ArrayList<Passive_throw_HitBox> pthb = new ArrayList<Passive_throw_HitBox>();
|
||||
ArrayList<Active_HitBox> ahb = new ArrayList<Active_HitBox>();
|
||||
ArrayList<Active_throw_Hitbox> athb = new ArrayList<Active_throw_Hitbox>();
|
||||
|
||||
/*
|
||||
Individual hitboxes creation
|
||||
*/
|
||||
Passive_HitBox phb1 = new Passive_HitBox(270,-70,200,500);
|
||||
Passive_throw_HitBox pthb1 = new Passive_throw_HitBox(270,-600,250,100);
|
||||
Push_HitBox pushB = new Push_HitBox(270,-70,150,550);
|
||||
|
||||
/*
|
||||
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,false,false,false,false);
|
||||
f.setSpriteWrap(138*4,138*5,138,138);
|
||||
return f;
|
||||
}
|
||||
|
||||
protected static attackPart lDPStartup() {
|
||||
Frame[] f = new Frame[3];
|
||||
f[0] = lDPFrame1();
|
||||
f[1] = lDPFrame2();
|
||||
f[2] = lDPFrame2();
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart lDPRecovery() {
|
||||
Frame[] f = new Frame[29];
|
||||
for(int i = 0; i < 11; i++) {
|
||||
f[i] = lDPFrame5();
|
||||
}
|
||||
for(int i = 11; i < f.length; i++) {
|
||||
f[i] = lDPFrame6();
|
||||
}
|
||||
return(new attackPart(f));
|
||||
}
|
||||
|
||||
protected static attackPart lDPActive() {
|
||||
Frame[] f = new Frame[11];
|
||||
for(int i = 0; i < 5; i++) {
|
||||
f[i] = lDPFrame3();
|
||||
}
|
||||
|
||||
for(int i = 5; i < f.length; i++) {
|
||||
f[i] = lDPFrame4();
|
||||
}
|
||||
|
||||
return(new attackPart(100,4,20,18,16,14,f,false,false,true));
|
||||
}
|
||||
|
||||
protected static Attack blueLDP() {
|
||||
ButtonIG[][] cmd = {{FORWARD},{DOWN},{DOWN,FORWARD},{A}};
|
||||
boolean isSpecial = true;
|
||||
Status rS = Status.NORMAL;
|
||||
attackPart[] parts = {lDPStartup(),lDPActive(),lDPRecovery()};
|
||||
return new Attack(isSpecial,rS,cmd,parts);
|
||||
}
|
||||
|
||||
}
|
72
src/main/java/gameplay/Characters/Blue/CharacterBlue.java
Normal file
@ -0,0 +1,72 @@
|
||||
package gameplay.Characters.Blue;
|
||||
|
||||
import gameplay.actions.*;
|
||||
import gameplay.entities.Character;
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.Characters.Blue.BlueBaseFrames.*;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static gameplay.Characters.Blue.BlueNormals.*;
|
||||
import static gameplay.Characters.Blue.BlueSpecials.blueLDP;
|
||||
import static gameplay.input.ButtonIG.*;
|
||||
|
||||
public class CharacterBlue {
|
||||
public static Character generateCharBlue(){
|
||||
Frame[] standF = BlueBaseFrames.blueStandFrames();
|
||||
Frame[] crouchF = BlueBaseFrames.blueCrouchFrames();
|
||||
Frame[] nJumpF = BlueBaseFrames.blueNeutralJump();
|
||||
Frame[] fJumpF = BlueBaseFrames.blueForwardJump();
|
||||
Frame[] bJumpF = BlueBaseFrames.blueBackJump();
|
||||
Frame[] fWalkF = BlueBaseFrames.blueFWalk();
|
||||
Frame[] bWalkF = BlueBaseFrames.blueBWalk();
|
||||
|
||||
ButtonIG[][] fjcmd = {{UP,FORWARD}};
|
||||
ButtonIG[][] bjcmd = {{UP,BACK}};
|
||||
ButtonIG[][] njcmd = {{UP}};
|
||||
|
||||
|
||||
Jump fJ = new Jump(fjcmd,fJumpF);
|
||||
Jump nJ = new Jump(njcmd,nJumpF);
|
||||
Jump bJ = new Jump(bjcmd,bJumpF);
|
||||
|
||||
Attack[] atks = {blueLDP(),blueJumpJab(),blueJumpFierce(),blueJumpShort(),blueJumpRoundHouse(),
|
||||
blueFordwardRoundHouse(),
|
||||
blueCrouchFierce(),blueCrouchJab(),blueCrouchShort(),blueCrouchRoundHouse(),
|
||||
blueStandHeavyKick(),blueStandJab(),blueStandFierce(),blueStandShort()};
|
||||
|
||||
Frame shf = BlueMisc.blueStandHit();
|
||||
Frame chf = BlueMisc.blueCrouchHit();
|
||||
Frame sbf = BlueMisc.blueStandGuard();
|
||||
Frame cbf = BlueMisc.blueCrouchGuard();
|
||||
|
||||
Frame falling = BlueMisc.falling();
|
||||
Frame hia = BlueMisc.airHit();
|
||||
/*
|
||||
* Temporary values to change later
|
||||
*/
|
||||
Frame[] fDashF = BlueMisc.blueFDash();
|
||||
Frame[] bDashF = BlueMisc.blueBDash();
|
||||
|
||||
ThrowPart[] tp = new ThrowPart[0];
|
||||
|
||||
ButtonIG[][] throwCMD = {{BACK,FORWARD,UP,DOWN},{BACK,FORWARD,UP,DOWN},{BACK,FORWARD,UP,DOWN}};
|
||||
ButtonIG[][] fdashCMD = {{FORWARD},{},{FORWARD}};
|
||||
ButtonIG[][] bdashCMD = {{BACK},{},{BACK}};
|
||||
|
||||
Throw th = new Throw(false,throwCMD,tp);
|
||||
Dash fDash = new Dash(fdashCMD,fDashF);
|
||||
Dash bDash =new Dash(bdashCMD,bDashF);
|
||||
|
||||
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,hia,falling,knDwn,sbf,cbf,shf,chf);
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
13
src/main/java/gameplay/actions/Action.java
Normal file
@ -0,0 +1,13 @@
|
||||
package gameplay.actions;
|
||||
|
||||
import gameplay.frames.*;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface Action {
|
||||
|
||||
ArrayList<Frame> getFrame();
|
||||
|
||||
abstract ButtonIG[][] getCommand();
|
||||
}
|
93
src/main/java/gameplay/actions/Attack.java
Normal file
@ -0,0 +1,93 @@
|
||||
package gameplay.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import gameplay.entities.Status;
|
||||
import gameplay.frames.*;
|
||||
import gameplay.input.*;
|
||||
|
||||
public class Attack implements Action {
|
||||
/**
|
||||
* Defines if the attack is a special one (E.G. a fireball) or a normal one (a punch)
|
||||
*/
|
||||
private boolean isSpecial;
|
||||
|
||||
private Status requiredStatus;
|
||||
|
||||
|
||||
/**
|
||||
* The suite of Inputs to have the move come out.
|
||||
* For example, a classic fireball would be something like
|
||||
* {{DOWN},{DOWN,RIGHT},{RIGHT},{A}}
|
||||
*/
|
||||
private ButtonIG[][] command;
|
||||
|
||||
|
||||
/**
|
||||
* The different sections of the attack
|
||||
*/
|
||||
private attackPart[] parts;
|
||||
|
||||
public Attack(boolean isSpecial, Status requiredStatus, ButtonIG[][] command, attackPart[] parts) {
|
||||
this.isSpecial = isSpecial;
|
||||
this.requiredStatus = requiredStatus;
|
||||
this.command = command;
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Frame> getFrame() {
|
||||
ArrayList<Frame> res = new ArrayList<Frame>();
|
||||
|
||||
//browse parts
|
||||
for(int i = 0; i < this.parts.length; i++) {
|
||||
|
||||
//stock current tab of frames
|
||||
Frame[] tmp = this.parts[i].getFrames();
|
||||
int size = tmp.length;
|
||||
|
||||
//browse the tab of frames and add it into a list
|
||||
for(int j = 0; j < size; j++) {
|
||||
res.add(tmp[j]);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public boolean isIsSpecial() {
|
||||
return this.isSpecial;
|
||||
}
|
||||
|
||||
public void setIsSpecial(boolean isSpecial) {
|
||||
this.isSpecial = isSpecial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ButtonIG[][] getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public void setCommand(ButtonIG[][] command) {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public attackPart[] getParts() {
|
||||
return parts;
|
||||
}
|
||||
|
||||
public void setParts(attackPart[] parts) {
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
public Status getRequiredStatus() {
|
||||
return this.requiredStatus;
|
||||
}
|
||||
|
||||
public void setRequiredStatus(Status requiredStatus) {
|
||||
this.requiredStatus = requiredStatus;
|
||||
}
|
||||
|
||||
public boolean isSpecial() {return this.isSpecial;}
|
||||
|
||||
|
||||
}
|
37
src/main/java/gameplay/actions/Dash.java
Normal file
@ -0,0 +1,37 @@
|
||||
package gameplay.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
public class Dash implements Action {
|
||||
/**
|
||||
* The suite of Inputs to have the move come out.
|
||||
* For example, a Front Dash would be something like
|
||||
* {{FORWARD},{FORWARD}}
|
||||
*/
|
||||
private ButtonIG[][] command;
|
||||
|
||||
private Frame[] frames;
|
||||
|
||||
|
||||
@Override
|
||||
public ArrayList<Frame> getFrame() {
|
||||
ArrayList<Frame> res = new ArrayList<Frame>();
|
||||
|
||||
for(int i = 0; i < frames.length; i++) {res.add(frames[i]);}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ButtonIG[][] getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public Dash(ButtonIG[][] command, Frame[] frames) {
|
||||
this.command = command;
|
||||
this.frames = frames;
|
||||
}
|
||||
}
|
37
src/main/java/gameplay/actions/Jump.java
Normal file
@ -0,0 +1,37 @@
|
||||
package gameplay.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
public class Jump implements Action {
|
||||
|
||||
/**
|
||||
* The Input to have the move come out.
|
||||
* For example, a Front Jump would be something like
|
||||
* {{UP,RIGHT}}
|
||||
*/
|
||||
private ButtonIG[][] command;
|
||||
|
||||
private Frame[] frames;
|
||||
|
||||
@Override
|
||||
public ArrayList<Frame> getFrame() {
|
||||
ArrayList<Frame> res = new ArrayList<Frame>();
|
||||
|
||||
for(int i = 0; i < frames.length; i++) {res.add(frames[i]);}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ButtonIG[][] getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public Jump(ButtonIG[][] command, Frame[] frames) {
|
||||
this.command = command;
|
||||
this.frames = frames;
|
||||
}
|
||||
}
|
71
src/main/java/gameplay/actions/Throw.java
Normal file
@ -0,0 +1,71 @@
|
||||
package gameplay.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
public class Throw implements Action {
|
||||
|
||||
/**
|
||||
* Defines if the throw is a special one (E.G. a Moonsault Press ) or a normal one
|
||||
*/
|
||||
private boolean isSpecial;
|
||||
|
||||
/**
|
||||
* The suite of Inputs to have the move come out.
|
||||
* For example, a Moonsault Press would be something like
|
||||
* {{LEFT},{DOWN,LEFT},{DOWN},{DOWN,RIGHT},{RIGHT},{RIGHT,UP},{UP},{A}}
|
||||
*/
|
||||
private ButtonIG[][] command;
|
||||
|
||||
/**
|
||||
* The different sections of the throw
|
||||
*/
|
||||
private ThrowPart[] parts;
|
||||
|
||||
@Override
|
||||
public ArrayList<Frame> getFrame() {
|
||||
ArrayList<Frame> res = new ArrayList<Frame>();
|
||||
|
||||
//browse parts
|
||||
for(int i = 0; i < this.parts.length; i++) {
|
||||
|
||||
//stock current tab of frames
|
||||
Frame[] tmp = this.parts[i].getFrames();
|
||||
int size = tmp.length;
|
||||
if(this.parts[i].getisActive()) {
|
||||
if(this.parts[i].hasHit()) {
|
||||
for(int j = 0; j < size; j++) {
|
||||
res.add(tmp[i]);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
//browse the tab of frames and add it into a list
|
||||
for(int j = 0; j < size; j++) {
|
||||
res.add(tmp[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ButtonIG[][] getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public Throw(boolean isSpecial, ThrowPart[] parts) {
|
||||
this.isSpecial = isSpecial;
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
public Throw() {
|
||||
}
|
||||
|
||||
public Throw(boolean isSpecial, ButtonIG[][] command, ThrowPart[] parts) {
|
||||
this.isSpecial = isSpecial;
|
||||
this.command = command;
|
||||
this.parts = parts;
|
||||
}
|
||||
}
|
98
src/main/java/gameplay/actions/ThrowPart.java
Normal file
@ -0,0 +1,98 @@
|
||||
package gameplay.actions;
|
||||
|
||||
import gameplay.frames.Frame;
|
||||
|
||||
public class ThrowPart {
|
||||
private int damage, hitstun;
|
||||
private double knockbackOnHit;
|
||||
private Frame[] frames;
|
||||
private boolean hasHit;
|
||||
private boolean isActive;
|
||||
|
||||
/**
|
||||
* Constructor with most parameters for an attack part, generally a hit
|
||||
* @param damage the damage dealt to the enemy if the throw part connects
|
||||
* @param hitstun the amount of frames where the enemy is in hitstun if the throw part connects
|
||||
* @param knockbackOnHit the distance the enemy gets moved back if throwed
|
||||
* @param frames the array of frames for the part
|
||||
* @param isActive true if the part is an active part
|
||||
*/
|
||||
public ThrowPart(int damage, int hitstun, double knockbackOnHit, Frame[] frames, boolean isActive) {
|
||||
this.damage = damage;
|
||||
this.hitstun = hitstun;
|
||||
this.knockbackOnHit = knockbackOnHit;
|
||||
this.frames = frames;
|
||||
this.hasHit = false;
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for an attack part with only a frames array as parameter.
|
||||
* Generally for a move startup or recovery.
|
||||
* @param frames the array of frames for the part
|
||||
*/
|
||||
public ThrowPart(Frame[] frames) {
|
||||
this.frames = frames;
|
||||
this.damage = 0;
|
||||
this.hitstun = 0;
|
||||
this.knockbackOnHit = 0.0;
|
||||
this.hasHit = false;
|
||||
this.isActive = false;
|
||||
}
|
||||
|
||||
public boolean hasHit() {
|
||||
return hasHit;
|
||||
}
|
||||
|
||||
public void setHasHit(boolean hasHit) {
|
||||
this.hasHit = hasHit;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public void setDamage(int damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
public int getHitstun() {
|
||||
return hitstun;
|
||||
}
|
||||
|
||||
public void setHitstun(int hitstun) {
|
||||
this.hitstun = hitstun;
|
||||
}
|
||||
|
||||
public double getKnockbackOnHit() {
|
||||
return knockbackOnHit;
|
||||
}
|
||||
|
||||
public void setKnockbackOnHit(double knockback) {
|
||||
this.knockbackOnHit = knockback;
|
||||
}
|
||||
|
||||
public Frame[] getFrames() {
|
||||
return frames;
|
||||
}
|
||||
|
||||
public void setFrames(Frame[] frames) {
|
||||
this.frames = frames;
|
||||
}
|
||||
|
||||
public boolean getisActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setisActive(boolean isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public void clone(ThrowPart tP) {
|
||||
this.hasHit = tP.hasHit();
|
||||
this.hitstun = tP.getHitstun();
|
||||
this.frames = tP.getFrames();
|
||||
this.knockbackOnHit = tP.getKnockbackOnHit();
|
||||
this.damage = tP.getDamage();
|
||||
}
|
||||
}
|
174
src/main/java/gameplay/actions/attackPart.java
Normal file
@ -0,0 +1,174 @@
|
||||
package gameplay.actions;
|
||||
|
||||
import gameplay.frames.Frame;
|
||||
|
||||
/**
|
||||
* This class represent one section (generally one isolated hit) of an attack.
|
||||
*/
|
||||
public class attackPart {
|
||||
private int damage, chipDamage, hitstun, blockstun;
|
||||
private double knockbackOnHit, knockbackOnBlock;
|
||||
private Frame[] frames;
|
||||
private boolean hasHit;
|
||||
private boolean isOverHead, isLow, knocksDown;
|
||||
|
||||
/**
|
||||
* Constructor with most parameters for an attack part, generally a hit
|
||||
* @param damage the damage dealt to the enemy if the attack part connects
|
||||
* @param chipDamage the damage dealt to the enemy if the attack part is blocked
|
||||
* @param hitstun the amount of frames where the enemy is in hitstun if the attack part connects
|
||||
* @param blockstun the amount of frames where the enemy is in blockstun if the attack part is blocked
|
||||
* @param knockbackOnHit the distance the enemy gets moved back if hit
|
||||
* @param knockbackOnBlock the distance the enemy gets moved back if blocked
|
||||
* @param frames the array of frames for the part
|
||||
* @param isLow whether or not the hit hits low
|
||||
* @param isOverHead whether or not the hit is an overhead
|
||||
* @param knocksDown whether or not the hit knocks down
|
||||
*/
|
||||
public attackPart(int damage, int chipDamage, int hitstun, int blockstun, double knockbackOnHit, double knockbackOnBlock, Frame[] frames, boolean isLow, boolean isOverHead, boolean knocksDown) {
|
||||
this.damage = damage;
|
||||
this.chipDamage = chipDamage;
|
||||
this.hitstun = hitstun;
|
||||
this.blockstun = blockstun;
|
||||
this.knockbackOnHit = knockbackOnHit;
|
||||
this.knockbackOnHit = knockbackOnBlock;
|
||||
this.frames = frames;
|
||||
if(this.frames.length >= 1) {this.frames[this.frames.length-1].setLastFrameOfHit(true);}
|
||||
this.hasHit = false;
|
||||
this.isLow = isLow;
|
||||
this.isOverHead = isOverHead;
|
||||
this.knocksDown = knocksDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for an attack part with only a frames array as parameter.
|
||||
* Generally for a move startup or recovery.
|
||||
* @param frames the array of frames for the part
|
||||
*/
|
||||
public attackPart(Frame[] frames) {
|
||||
this.frames = frames;
|
||||
this.damage = 0;
|
||||
this.chipDamage = 0;
|
||||
this.hitstun = 0;
|
||||
this.blockstun = 0;
|
||||
this.knockbackOnHit = 0.0;
|
||||
this.knockbackOnBlock = 0.0;
|
||||
this.hasHit = false;
|
||||
if(this.frames.length >= 1) {this.frames[this.frames.length -1].setLastFrameOfHit(true);}
|
||||
this.isLow = false;
|
||||
this.isOverHead = false;
|
||||
this.knocksDown = false;
|
||||
|
||||
}
|
||||
|
||||
public boolean hasHit() {
|
||||
return hasHit;
|
||||
}
|
||||
|
||||
public void setHasHit(boolean hasHit) {
|
||||
this.hasHit = hasHit;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return this.damage;
|
||||
}
|
||||
|
||||
public void setDamage(int damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
public int getChipDamage() {
|
||||
return this.chipDamage;
|
||||
}
|
||||
|
||||
public void setChipDamage(int chipDamage) {
|
||||
this.chipDamage = chipDamage;
|
||||
}
|
||||
|
||||
public int getHitstun() {
|
||||
return hitstun;
|
||||
}
|
||||
|
||||
public void setHitstun(int hitstun) {
|
||||
this.hitstun = hitstun;
|
||||
}
|
||||
|
||||
public int getBlockstun() {
|
||||
return blockstun;
|
||||
}
|
||||
|
||||
public void setBlockstun(int blockstun) {
|
||||
this.blockstun = blockstun;
|
||||
}
|
||||
|
||||
public double getKnockbackOnHit() {
|
||||
return knockbackOnHit;
|
||||
}
|
||||
|
||||
public void setKnockbackOnHit(double knockback) {
|
||||
this.knockbackOnHit = knockback;
|
||||
}
|
||||
|
||||
public Frame[] getFrames() {
|
||||
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) {
|
||||
this.frames = frames;
|
||||
}
|
||||
|
||||
public double getKnockbackOnBlock() {
|
||||
return knockbackOnBlock;
|
||||
}
|
||||
|
||||
public void setKnockbackOnBlock(double knockbackOnBlock) {
|
||||
this.knockbackOnBlock = knockbackOnBlock;
|
||||
}
|
||||
|
||||
public void clone(attackPart aP) {
|
||||
this.hasHit = aP.hasHit();
|
||||
this.blockstun = aP.getBlockstun();
|
||||
this.hitstun = aP.getHitstun();
|
||||
this.chipDamage = aP.getChipDamage();
|
||||
this.frames = aP.getFrames();
|
||||
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() {
|
||||
return hasHit;
|
||||
}
|
||||
|
||||
public boolean isOverHead() {
|
||||
return isOverHead;
|
||||
}
|
||||
|
||||
public void setOverHead(boolean overHead) {
|
||||
isOverHead = overHead;
|
||||
}
|
||||
|
||||
public boolean isLow() {
|
||||
return isLow;
|
||||
}
|
||||
|
||||
public void setLow(boolean low) {
|
||||
isLow = low;
|
||||
}
|
||||
|
||||
public boolean knocksDown() {
|
||||
return knocksDown;
|
||||
}
|
||||
|
||||
public void setKnockDown(boolean knocksDown) {
|
||||
this.knocksDown = knocksDown;
|
||||
}
|
||||
}
|
320
src/main/java/gameplay/entities/Character.java
Normal file
@ -0,0 +1,320 @@
|
||||
package gameplay.entities;
|
||||
|
||||
import gameplay.actions.*;
|
||||
import gameplay.frames.Frame;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Character class, which is a sub-class of an entity
|
||||
* @author Victor
|
||||
*
|
||||
*/
|
||||
public class Character extends Entity {
|
||||
private int maxHP;
|
||||
private int currentHP;
|
||||
|
||||
/**
|
||||
* All of the attacks, both special and normal, of the character
|
||||
* They should be put in the order of priority (attacks[0] being the highest priority)
|
||||
* For example, you should have something like :
|
||||
* {Rising Punch, FireBall, Jump D/C/B/A, Crouch D/C/B/A, Stand D/C/B/A}
|
||||
*/
|
||||
private Attack[] attacks;
|
||||
|
||||
private Jump forwardJump;
|
||||
private Jump neutralJump;
|
||||
private Jump backJump;
|
||||
|
||||
private Dash forwardDash;
|
||||
private Dash backDash;
|
||||
|
||||
private Throw normalthrow;
|
||||
|
||||
private Status status;
|
||||
|
||||
private Frame[] defaultStandingFrames;
|
||||
private Frame[] defaultCrouchingFrames;
|
||||
private Frame[] forwardWalkFrames;
|
||||
private Frame[] backWalkFrames;
|
||||
private Frame hitInAirFrame; //the frame to display when hit in the air. Shouldmake the character rise
|
||||
private Frame fallingframe; //the frame to display when falling from the air
|
||||
private Frame[] knockedDownFrames;
|
||||
private Frame standGuardFrame;
|
||||
private Frame crouchGuardFrame;
|
||||
private Frame standHitFrame;
|
||||
private Frame crouchHitFrame;
|
||||
|
||||
private ArrayList<attackPart> nextAttackParts;
|
||||
private ArrayList<ThrowPart> nextThrowParts;
|
||||
|
||||
/**
|
||||
* Main constructor for a character. By default its max health is 1000 if not specified
|
||||
*/
|
||||
public Character() {
|
||||
super();
|
||||
this.maxHP = 1000;
|
||||
this.currentHP = this.maxHP;
|
||||
this.status = Status.NORMAL;
|
||||
}
|
||||
|
||||
public Character(int posx, int posy, Frame f, int maxHP) {
|
||||
super(posx, posy, f);
|
||||
this.maxHP = maxHP;
|
||||
this.status = Status.NORMAL;
|
||||
this.currentHP = this.maxHP;
|
||||
}
|
||||
|
||||
public Character(int posx, int posy, Frame f, int maxHP, Attack[] attacks, Jump forwardJump, Jump neutralJump, Jump backJump, Dash forwardDash, Dash backDash, Throw normalthrow, Frame[] defaultStandingFrames, Frame[] defaultCrouchingFrames, Frame[] forwardWalkFrames, Frame[] backWalkFrames, Frame hitInAirFrame, Frame fallingframe, Frame[] knockedDownFrames, Frame standGuardFrame, Frame crouchGuardFrame, Frame standHitFrame, Frame crouchHitFrame) {
|
||||
super(posx, posy, f);
|
||||
this.maxHP = maxHP;
|
||||
this.attacks = attacks;
|
||||
this.forwardJump = forwardJump;
|
||||
this.neutralJump = neutralJump;
|
||||
this.backJump = backJump;
|
||||
this.forwardDash = forwardDash;
|
||||
this.backDash = backDash;
|
||||
this.normalthrow = normalthrow;
|
||||
this.defaultStandingFrames = defaultStandingFrames;
|
||||
this.defaultCrouchingFrames = defaultCrouchingFrames;
|
||||
this.forwardWalkFrames = forwardWalkFrames;
|
||||
this.backWalkFrames = backWalkFrames;
|
||||
this.hitInAirFrame = hitInAirFrame;
|
||||
this.fallingframe = fallingframe;
|
||||
this.knockedDownFrames = knockedDownFrames;
|
||||
this.standGuardFrame = standGuardFrame;
|
||||
this.crouchGuardFrame = crouchGuardFrame;
|
||||
this.standHitFrame = standHitFrame;
|
||||
this.crouchHitFrame = crouchHitFrame;
|
||||
this.nextAttackParts = new ArrayList<attackPart>();
|
||||
this.nextThrowParts = new ArrayList<ThrowPart>();
|
||||
this.currentHP = maxHP;
|
||||
this.status = Status.NORMAL;
|
||||
}
|
||||
|
||||
public void setMaxHP(int HP) {
|
||||
this.maxHP = HP;
|
||||
}
|
||||
|
||||
public int getMaxHP() { return this.maxHP;}
|
||||
|
||||
public Attack[] getAttacks() {
|
||||
return this.attacks;
|
||||
}
|
||||
|
||||
public void setAttacks(Attack[] attacks) {
|
||||
this.attacks = attacks;
|
||||
}
|
||||
|
||||
public Jump getForwardJump() {
|
||||
return this.forwardJump;
|
||||
}
|
||||
|
||||
public void setForwardJump(Jump forwardJump) {
|
||||
this.forwardJump = forwardJump;
|
||||
}
|
||||
|
||||
public Jump getNeutralJump() {
|
||||
return this.neutralJump;
|
||||
}
|
||||
|
||||
public void setNeutralJump(Jump neutralJump) {
|
||||
this.neutralJump = neutralJump;
|
||||
}
|
||||
|
||||
public Jump getBackJump() {
|
||||
return this.backJump;
|
||||
}
|
||||
|
||||
public void setBackJump(Jump backJump) {
|
||||
this.backJump = backJump;
|
||||
}
|
||||
|
||||
public Dash getForwardDash() {
|
||||
return this.forwardDash;
|
||||
}
|
||||
|
||||
public void setForwardDash(Dash forwardDash) {
|
||||
this.forwardDash = forwardDash;
|
||||
}
|
||||
|
||||
public Dash getBackDash() {
|
||||
return this.backDash;
|
||||
}
|
||||
|
||||
public void setBackDash(Dash backDash) {
|
||||
this.backDash = backDash;
|
||||
}
|
||||
|
||||
public Throw getNormalthrow() {
|
||||
return this.normalthrow;
|
||||
}
|
||||
|
||||
public void setNormalthrow(Throw normalthrow) {
|
||||
this.normalthrow = normalthrow;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Frame[] getDefaultStandingFrames() {
|
||||
return this.defaultStandingFrames;
|
||||
}
|
||||
|
||||
public void setDefaultStandingFrames(Frame[] defaultStandingFrames) {
|
||||
this.defaultStandingFrames = defaultStandingFrames;
|
||||
}
|
||||
|
||||
public Frame[] getDefaultCrouchingFrames() {
|
||||
return this.defaultCrouchingFrames;
|
||||
}
|
||||
|
||||
public void setDefaultCrouchingFrames(Frame[] defaultCrouchingFrames) {
|
||||
this.defaultCrouchingFrames = defaultCrouchingFrames;
|
||||
}
|
||||
|
||||
public Frame[] getForwardWalkFrames() {
|
||||
return this.forwardWalkFrames;
|
||||
}
|
||||
|
||||
public void setForwardWalkFrames(Frame[] forwardWalkFrames) {
|
||||
this.forwardWalkFrames = forwardWalkFrames;
|
||||
}
|
||||
|
||||
public Frame[] getBackWalkFrames() {
|
||||
return this.backWalkFrames;
|
||||
}
|
||||
|
||||
public void setBackWalkFrames(Frame[] backWalkFrames) {
|
||||
this.backWalkFrames = backWalkFrames;
|
||||
}
|
||||
|
||||
public ArrayList<attackPart> getNextAttackParts() {
|
||||
return this.nextAttackParts;
|
||||
}
|
||||
|
||||
public void setNextAttackParts(ArrayList<attackPart> nextAttackParts) {
|
||||
this.nextAttackParts = new ArrayList<attackPart>(nextAttackParts);
|
||||
}
|
||||
|
||||
public void setAttackPartsArray(attackPart[] parts) {
|
||||
this.nextAttackParts = new ArrayList<attackPart>();
|
||||
this.nextAttackParts.addAll(Arrays.asList(parts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes current attack part from the list,
|
||||
* which indicates the character has moved on to the next one
|
||||
*/
|
||||
public void removeFirstAttackPart() {
|
||||
if(this.nextAttackParts.size() > 0) {this.nextAttackParts.remove(0);}
|
||||
}
|
||||
|
||||
public ArrayList<ThrowPart> getNextThrowParts() {
|
||||
return this.nextThrowParts;
|
||||
}
|
||||
|
||||
public void setNextThrowParts(ArrayList<ThrowPart> nextAttackParts) {
|
||||
this.nextThrowParts = new ArrayList<ThrowPart>(nextAttackParts);
|
||||
}
|
||||
|
||||
public void setThrowPartsArray(ThrowPart[] parts) {
|
||||
this.nextThrowParts = new ArrayList<ThrowPart>();
|
||||
for(int i = 0; i < parts.length; i++) {
|
||||
this.nextThrowParts.add(parts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes current Throw part from the list,
|
||||
* which indicates the character has moved on to the next one
|
||||
*/
|
||||
public void removeFirstThrowPart() {
|
||||
this.nextThrowParts.remove(0);
|
||||
}
|
||||
|
||||
public int getCurrentHP() {
|
||||
return this.currentHP;
|
||||
}
|
||||
|
||||
public void setCurrentHP(int currentHP) {
|
||||
this.currentHP = currentHP;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduces the current hp of the character by a certain amount.
|
||||
* @param dmg the amount of hp to reduce to the character's current hp
|
||||
*/
|
||||
public void reduceHP(int dmg) {
|
||||
this.currentHP = this.currentHP - dmg;
|
||||
}
|
||||
|
||||
/**
|
||||
* puts the character's current hp back to its max value
|
||||
*/
|
||||
public void resetCurrentHP() {
|
||||
this.currentHP = this.maxHP;
|
||||
}
|
||||
|
||||
public Frame getHitInAirFrame() {
|
||||
return this.hitInAirFrame;
|
||||
}
|
||||
|
||||
public void setHitInAirFrame(Frame hitInAirFrame) {
|
||||
this.hitInAirFrame = hitInAirFrame;
|
||||
}
|
||||
|
||||
public Frame getFallingframe() {
|
||||
return this.fallingframe;
|
||||
}
|
||||
|
||||
public void setFallingframe(Frame fallingframe) {
|
||||
this.fallingframe = fallingframe;
|
||||
}
|
||||
|
||||
public Frame[] getKnockedDownFrames() {
|
||||
return this.knockedDownFrames;
|
||||
}
|
||||
|
||||
public void setKnockedDownFrames(Frame[] knockedDownFrames) {
|
||||
this.knockedDownFrames = knockedDownFrames;
|
||||
}
|
||||
|
||||
public Frame getStandGuardFrame() {
|
||||
return this.standGuardFrame;
|
||||
}
|
||||
|
||||
public void setStandGuardFrame(Frame standGuardFrame) {
|
||||
this.standGuardFrame = standGuardFrame;
|
||||
}
|
||||
|
||||
public Frame getCrouchGuardFrame() {
|
||||
return this.crouchGuardFrame;
|
||||
}
|
||||
|
||||
public void setCrouchGuardFrame(Frame crouchGuardFrame) {
|
||||
this.crouchGuardFrame = crouchGuardFrame;
|
||||
}
|
||||
|
||||
public Frame getStandHitFrame() {
|
||||
return this.standHitFrame;
|
||||
}
|
||||
|
||||
public void setStandHitFrame(Frame standHitFrame) {
|
||||
this.standHitFrame = standHitFrame;
|
||||
}
|
||||
|
||||
public Frame getCrouchHitFrame() {
|
||||
return this.crouchHitFrame;
|
||||
}
|
||||
|
||||
public void setCrouchHitFrame(Frame crouchHitFrame) {
|
||||
this.crouchHitFrame = crouchHitFrame;
|
||||
}
|
||||
}
|
102
src/main/java/gameplay/entities/Entity.java
Normal file
@ -0,0 +1,102 @@
|
||||
package gameplay.entities;
|
||||
|
||||
import gameplay.frames.Frame;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Entity class, which is the main class regrouping characters and projectiles
|
||||
* @author Victor
|
||||
*
|
||||
*/
|
||||
public class Entity {
|
||||
private int posx;
|
||||
private int posy;
|
||||
|
||||
private ArrayList<Frame> frames;
|
||||
|
||||
/**
|
||||
* base constructor of the entity class
|
||||
*/
|
||||
public Entity() {
|
||||
this.posx = 0;
|
||||
this.posy = 0;
|
||||
this.frames = new ArrayList<Frame>();
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor of the entity class with parameters
|
||||
* @param posx the position of the entity on the x axis
|
||||
* @param posy the position of the entity on the y axis
|
||||
* @param f the current frame of the new entity
|
||||
*/
|
||||
public Entity(int posx, int posy, Frame f) {
|
||||
this.posx = posx;
|
||||
this.posy = posy;
|
||||
this.frames = new ArrayList<>();
|
||||
this.frames.add(f);
|
||||
}
|
||||
|
||||
public void setPos(int x, int y) {
|
||||
this.posx = x;
|
||||
this.posy = y;
|
||||
}
|
||||
|
||||
public void setCurrentFrame(Frame f) {
|
||||
this.frames.set(0,f);
|
||||
}
|
||||
|
||||
public int getPosX() {return this.posx;}
|
||||
|
||||
public int getPosY() {return this.posy;}
|
||||
|
||||
public Frame getCurrentframe() {return this.frames.get(0);}
|
||||
|
||||
public ArrayList<Frame> getFrames() {
|
||||
return this.frames;
|
||||
}
|
||||
|
||||
public void setFrames(ArrayList<Frame> nextFrames) {
|
||||
this.frames = nextFrames;
|
||||
}
|
||||
|
||||
public void clearNextFrames() {
|
||||
Frame f = this.getCurrentframe();
|
||||
this.frames.clear();
|
||||
this.frames.add(f);
|
||||
}
|
||||
|
||||
public void goToNextFrames() { this.frames.remove(0);}
|
||||
|
||||
/**
|
||||
* adds frames to the character queue.
|
||||
* Warning : does not clear the queue first
|
||||
* @param f
|
||||
*/
|
||||
public void addNextFrames(Frame[] f) {
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
this.frames.add(f[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a list of frames to the character queue.
|
||||
* Warning : does not clear the queue first
|
||||
* @param f
|
||||
*/
|
||||
public void addNextFramesList(ArrayList<Frame> f) {
|
||||
for(int i = 0; i < f.size(); i++) {
|
||||
this.frames.add(f.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single Frame to the character's list of next frames
|
||||
* @param f the frame to add at the end of the frames list
|
||||
*/
|
||||
public void addSingleFrame(Frame f) {
|
||||
this.frames.add(f);
|
||||
}
|
||||
|
||||
|
||||
}
|
4
src/main/java/gameplay/entities/Projectile.java
Normal file
@ -0,0 +1,4 @@
|
||||
package gameplay.entities;
|
||||
|
||||
public class Projectile extends Entity{
|
||||
}
|
5
src/main/java/gameplay/entities/Status.java
Normal file
@ -0,0 +1,5 @@
|
||||
package gameplay.entities;
|
||||
|
||||
public enum Status {
|
||||
NORMAL, JUMPING, KNOCKEDDOWN, BLOCKING, FALLING, HITINAIR
|
||||
}
|
241
src/main/java/gameplay/frames/Frame.java
Normal file
@ -0,0 +1,241 @@
|
||||
package gameplay.frames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import engine.graphics.Texture;
|
||||
import gameplay.hitboxes.*;
|
||||
|
||||
/**
|
||||
* Main class for frames
|
||||
* @author Victor Azra
|
||||
*
|
||||
*/
|
||||
public class Frame {
|
||||
|
||||
private Double move_y;
|
||||
private Double move_x;
|
||||
private ArrayList<Passive_HitBox> passHitBox;
|
||||
private ArrayList<Active_HitBox> actHitBox;
|
||||
private ArrayList<Passive_throw_HitBox> passThrowHitBox;
|
||||
private ArrayList<Active_throw_Hitbox> actThrowHitBox;
|
||||
private Push_HitBox pushHitBox;
|
||||
private boolean normalCancellable;
|
||||
private boolean specialCancellable;
|
||||
private boolean jumpCancellable;
|
||||
private boolean moveCancellable;
|
||||
private boolean isDashCancellable;
|
||||
private boolean lastFrameOfHit;
|
||||
|
||||
/**
|
||||
* an int of 4 that determines the texture wrap for the frame
|
||||
*/
|
||||
private int[] sprite;
|
||||
|
||||
public Frame() {
|
||||
this.setMove_y(0.0);
|
||||
this.setMove_x(0.0);
|
||||
this.setPassHitBox(new ArrayList<Passive_HitBox>());
|
||||
this.setActHitBox(new ArrayList<Active_HitBox>());
|
||||
this.setPassThrowHitBox(new ArrayList<Passive_throw_HitBox>());
|
||||
this.setActThrowHitBox(new ArrayList<Active_throw_Hitbox>());
|
||||
this.setPushHitBox(new Push_HitBox());
|
||||
this.normalCancellable = true;
|
||||
this.specialCancellable = true;
|
||||
this.jumpCancellable = true;
|
||||
this.moveCancellable = true;
|
||||
this.isDashCancellable = true;
|
||||
this.lastFrameOfHit = false;
|
||||
this.sprite = new int[4];
|
||||
}
|
||||
|
||||
public Frame(Double move_y, Double move_x, ArrayList<Passive_HitBox> passHitBox, ArrayList<Active_HitBox> actHitBox,
|
||||
ArrayList<Passive_throw_HitBox> passThrowHitBox, ArrayList<Active_throw_Hitbox> actThrowHitBox,
|
||||
Push_HitBox pushHitBox, boolean normalCancellable, boolean specialCancellable, boolean jumpCancellable,
|
||||
boolean moveCancellable, boolean isDashCancellable) {
|
||||
this.setMove_y(move_y);
|
||||
this.setMove_x(move_x);
|
||||
this.setPassHitBox(passHitBox);
|
||||
this.setActHitBox(actHitBox);
|
||||
this.setPassThrowHitBox(passThrowHitBox);
|
||||
this.setActThrowHitBox(actThrowHitBox);
|
||||
this.setPushHitBox(pushHitBox);
|
||||
this.normalCancellable = normalCancellable;
|
||||
this.specialCancellable = specialCancellable;
|
||||
this.jumpCancellable = jumpCancellable;
|
||||
this.moveCancellable = moveCancellable;
|
||||
this.isDashCancellable = isDashCancellable;
|
||||
this.lastFrameOfHit = false;
|
||||
this.sprite = new int[4];
|
||||
}
|
||||
|
||||
/*
|
||||
* Mainly use for projectiles
|
||||
*/
|
||||
public Frame(Double move_y, Double move_x, ArrayList<Passive_HitBox> passHitBox, ArrayList<Active_HitBox> actHitBox) {
|
||||
this.setMove_y(move_y);
|
||||
this.setMove_x(move_x);
|
||||
this.setPassHitBox(passHitBox);
|
||||
this.setActHitBox(actHitBox);
|
||||
this.setPassThrowHitBox(new ArrayList<Passive_throw_HitBox>());
|
||||
this.setActThrowHitBox(new ArrayList<Active_throw_Hitbox>());
|
||||
this.setPushHitBox(new Push_HitBox());
|
||||
}
|
||||
|
||||
public boolean isNormalCancellable() {
|
||||
return normalCancellable;
|
||||
}
|
||||
|
||||
public boolean isSpecialCancellable() {
|
||||
return specialCancellable;
|
||||
}
|
||||
|
||||
public boolean isJumpCancellable() {
|
||||
return jumpCancellable;
|
||||
}
|
||||
|
||||
public boolean isMoveCancellable() {
|
||||
return moveCancellable;
|
||||
}
|
||||
|
||||
public boolean isDashCancellable() {
|
||||
return isDashCancellable;
|
||||
}
|
||||
|
||||
public Double getMove_y() {
|
||||
return move_y;
|
||||
}
|
||||
|
||||
public void setMove_y(Double move_y) {
|
||||
this.move_y = move_y;
|
||||
}
|
||||
|
||||
public Double getMove_x() {
|
||||
return move_x;
|
||||
}
|
||||
|
||||
public void setMove_x(Double move_x) {
|
||||
this.move_x = move_x;
|
||||
}
|
||||
|
||||
public ArrayList<Passive_HitBox> getPassHitBox() {
|
||||
return passHitBox;
|
||||
}
|
||||
|
||||
public void setPassHitBox(ArrayList<Passive_HitBox> passHitBox) {
|
||||
this.passHitBox = passHitBox;
|
||||
}
|
||||
|
||||
public ArrayList<Active_HitBox> getActHitBox() {
|
||||
return actHitBox;
|
||||
}
|
||||
|
||||
public void setActHitBox(ArrayList<Active_HitBox> actHitBox) {
|
||||
this.actHitBox = actHitBox;
|
||||
}
|
||||
|
||||
public ArrayList<Passive_throw_HitBox> getPassThrowHitBox() {
|
||||
return passThrowHitBox;
|
||||
}
|
||||
|
||||
public void setPassThrowHitBox(ArrayList<Passive_throw_HitBox> passThrowHitBox) {
|
||||
this.passThrowHitBox = passThrowHitBox;
|
||||
}
|
||||
|
||||
public ArrayList<Active_throw_Hitbox> getActThrowHitBox() {
|
||||
return actThrowHitBox;
|
||||
}
|
||||
|
||||
public void setActThrowHitBox(ArrayList<Active_throw_Hitbox> actThrowHitBox) {
|
||||
this.actThrowHitBox = actThrowHitBox;
|
||||
}
|
||||
|
||||
public Push_HitBox getPushHitBox() {
|
||||
return pushHitBox;
|
||||
}
|
||||
|
||||
public void setPushHitBox(Push_HitBox pushHitBox) {
|
||||
this.pushHitBox = pushHitBox;
|
||||
}
|
||||
|
||||
public boolean islastFrameOfHit() {
|
||||
return lastFrameOfHit;
|
||||
}
|
||||
|
||||
public void setLastFrameOfHit(boolean lastFrameOfHit) {
|
||||
this.lastFrameOfHit = lastFrameOfHit;
|
||||
}
|
||||
|
||||
//Inverts all hitboxes of the frame horizontally. Used if the character looks to the left instead of the right
|
||||
public void invertHitBoxes() {
|
||||
for(Passive_HitBox p: this.passHitBox) {p.reverseHorizontally();}
|
||||
for(Active_HitBox p: this.actHitBox) {p.reverseHorizontally();}
|
||||
for(Passive_throw_HitBox p: this.passThrowHitBox) {p.reverseHorizontally();}
|
||||
for(Active_throw_Hitbox p: this.actThrowHitBox) {p.reverseHorizontally();}
|
||||
this.pushHitBox.reverseHorizontally();
|
||||
}
|
||||
|
||||
public void clone(Frame f) {
|
||||
this.setMove_y(f.getMove_y());
|
||||
this.setMove_x(f.getMove_x());
|
||||
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]);
|
||||
}
|
||||
|
||||
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
|
||||
* @param y coordonate of the top
|
||||
* @param sizeH horizontal size of the sprite
|
||||
* @param sizeV horizontal size of the sprite
|
||||
*/
|
||||
public void setSpriteWrap(int x, int y, int sizeH, int sizeV) {
|
||||
this.sprite[0] = x;
|
||||
this.sprite[1] = y;
|
||||
this.sprite[2] = sizeH;
|
||||
this.sprite[3] = sizeV;
|
||||
}
|
||||
|
||||
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) {
|
||||
double moveX = this.move_x;
|
||||
double moveY = this.move_y;
|
||||
this.clone(f);
|
||||
this.setMove_x(moveX);
|
||||
this.setMove_y(moveY);
|
||||
}
|
||||
}
|
10
src/main/java/gameplay/hitboxes/Active_HitBox.java
Normal file
@ -0,0 +1,10 @@
|
||||
package gameplay.hitboxes;
|
||||
|
||||
public class Active_HitBox extends HitBox {
|
||||
public Active_HitBox() {
|
||||
super();
|
||||
}
|
||||
public Active_HitBox(float posX, float posY, float sizeX, float sizeY) {
|
||||
super(posX, posY, sizeX, sizeY);
|
||||
}
|
||||
}
|
10
src/main/java/gameplay/hitboxes/Active_throw_Hitbox.java
Normal file
@ -0,0 +1,10 @@
|
||||
package gameplay.hitboxes;
|
||||
|
||||
public class Active_throw_Hitbox extends HitBox {
|
||||
public Active_throw_Hitbox() {
|
||||
super();
|
||||
}
|
||||
public Active_throw_Hitbox(float posX, float posY, float sizeX, float sizeY) {
|
||||
super(posX, posY, sizeX, sizeY);
|
||||
}
|
||||
}
|
105
src/main/java/gameplay/hitboxes/HitBox.java
Normal file
@ -0,0 +1,105 @@
|
||||
package gameplay.hitboxes;
|
||||
|
||||
public class HitBox {
|
||||
|
||||
private float position_x;
|
||||
private float position_y;
|
||||
private float size_x;
|
||||
private float size_y;
|
||||
|
||||
public HitBox() {
|
||||
this.position_x = 0.0f;
|
||||
this.position_y = 0.0f;
|
||||
this.size_x = 0.0f;
|
||||
this.size_y = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
public HitBox(float posX, float posY, float sizeX, float sizeY) {
|
||||
this.position_x = posX;
|
||||
this.position_y = posY;
|
||||
this.size_x = sizeX;
|
||||
this.size_y = sizeY;
|
||||
}
|
||||
|
||||
public void setPosition_x(float position_x){
|
||||
this.position_x = position_x;
|
||||
}
|
||||
|
||||
public void setPosition_y(float position_y){
|
||||
this.position_y = position_y;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @param hb an Hitbox
|
||||
* @return true if HitBox overlap else return false
|
||||
*/
|
||||
public Boolean hit(HitBox hb) {
|
||||
Boolean horiz = false;
|
||||
Boolean ver = false;
|
||||
float horizontal1 = this.position_x + this.size_x;
|
||||
float vertical1 = this.position_y + this.size_y;
|
||||
float horizontal2 = hb.position_x + hb.size_x;
|
||||
float vertical2 = hb.position_y + hb.size_y;
|
||||
|
||||
|
||||
/*
|
||||
* HitBox overlap horizontally
|
||||
*/
|
||||
if(this.position_x < hb.position_x) { //this is at left of hb
|
||||
if(hb.position_x < horizontal1) {
|
||||
horiz = true;
|
||||
}
|
||||
}else {//this is at left of hb
|
||||
if(this.position_x < horizontal2) {
|
||||
horiz = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* HitBox overlap vertically
|
||||
*/
|
||||
if(this.position_y < hb.position_y) { //this is at top of hb
|
||||
if(hb.position_y < vertical1) {
|
||||
ver = true;
|
||||
}
|
||||
}else {//this is at left of hb
|
||||
if(this.position_x < vertical2) {
|
||||
ver = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return horiz && ver;
|
||||
}
|
||||
|
||||
public float getPosX() {
|
||||
return position_x;
|
||||
}
|
||||
|
||||
public float getPosY() {
|
||||
return position_y;
|
||||
}
|
||||
|
||||
public float getSize_x() {
|
||||
return size_x;
|
||||
}
|
||||
|
||||
public void setSize_x(float size_x) {
|
||||
this.size_x = size_x;
|
||||
}
|
||||
|
||||
public float getSize_y() {
|
||||
return size_y;
|
||||
}
|
||||
|
||||
public void setSize_y(float size_y) {
|
||||
this.size_y = size_y;
|
||||
}
|
||||
|
||||
public void reverseHorizontally() {
|
||||
this.position_x = 138*5 - position_x;
|
||||
this.size_x = -this.size_x;
|
||||
}
|
||||
}
|
10
src/main/java/gameplay/hitboxes/Passive_HitBox.java
Normal file
@ -0,0 +1,10 @@
|
||||
package gameplay.hitboxes;
|
||||
|
||||
public class Passive_HitBox extends HitBox {
|
||||
public Passive_HitBox() {
|
||||
super();
|
||||
}
|
||||
public Passive_HitBox(float posX, float posY, float sizeX, float sizeY) {
|
||||
super(posX, posY, sizeX, sizeY);
|
||||
}
|
||||
}
|
10
src/main/java/gameplay/hitboxes/Passive_throw_HitBox.java
Normal file
@ -0,0 +1,10 @@
|
||||
package gameplay.hitboxes;
|
||||
|
||||
public class Passive_throw_HitBox extends HitBox {
|
||||
public Passive_throw_HitBox() {
|
||||
super();
|
||||
}
|
||||
public Passive_throw_HitBox(float posX, float posY, float sizeX, float sizeY) {
|
||||
super(posX, posY, sizeX, sizeY);
|
||||
}
|
||||
}
|
11
src/main/java/gameplay/hitboxes/Push_HitBox.java
Normal file
@ -0,0 +1,11 @@
|
||||
package gameplay.hitboxes;
|
||||
|
||||
public class Push_HitBox extends HitBox {
|
||||
|
||||
public Push_HitBox() {
|
||||
super();
|
||||
}
|
||||
public Push_HitBox(float posX, float posY, float sizeX, float sizeY) {
|
||||
super(posX, posY, sizeX, sizeY);
|
||||
}
|
||||
}
|
46
src/main/java/gameplay/input/ButtonIG.java
Normal file
@ -0,0 +1,46 @@
|
||||
package gameplay.input;
|
||||
|
||||
/**
|
||||
* In-Game buttons, not to be mixed up with the physical gamepad buttons.
|
||||
*/
|
||||
public enum ButtonIG {
|
||||
UP, DOWN, BACK, FORWARD, A, B, C, D;
|
||||
|
||||
public int toInt() {
|
||||
switch (this) {
|
||||
case UP : return 0;
|
||||
case DOWN : return 1;
|
||||
case BACK : return 2;
|
||||
case FORWARD : return 3;
|
||||
case A : return 4;
|
||||
case B : return 5;
|
||||
case C : return 6;
|
||||
case D : return 7;
|
||||
default : return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case UP : return "UP";
|
||||
case DOWN : return "DOWN";
|
||||
case BACK : return "LEFT";
|
||||
case FORWARD : return "RIGHT";
|
||||
case A : return "A";
|
||||
case B : return "B";
|
||||
case C : return "C";
|
||||
case D : return "D";
|
||||
default : return "???";
|
||||
}
|
||||
}
|
||||
|
||||
public static ButtonIG intToButton(int i) {
|
||||
ButtonIG[] b = {UP, DOWN, BACK, FORWARD, A, B, C, D};
|
||||
try {
|
||||
return b[i];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
//TODO: put error message here
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
165
src/main/java/gameplay/input/InputBuffer.java
Normal file
@ -0,0 +1,165 @@
|
||||
package gameplay.input;
|
||||
|
||||
import engine.input.GamepadInput;
|
||||
|
||||
public class InputBuffer {
|
||||
|
||||
/**
|
||||
* The number of past frames to check for a certain input pas another one.
|
||||
* For example, if you need to input DOWN, then FORWARD, and we know FORWARD has been input on frame 25,
|
||||
* this indicates that you need to check for DOWN on frames 20 to 24
|
||||
*/
|
||||
private static final int pastFramesToCheck = 5;
|
||||
|
||||
/**
|
||||
* a list of various inputs being recorded, such as inputs pressed at each frame
|
||||
* Each element is a tab where each element represent a possible input
|
||||
* (UP, Down, Right, Left, A, B, C, D)
|
||||
* if the value at the corresponding index is true, then the input is pressed
|
||||
* By default, no input is pressed.
|
||||
*/
|
||||
private Inputs[] inputList;
|
||||
|
||||
/*
|
||||
* the size of the input buffer
|
||||
*/
|
||||
private int size;
|
||||
|
||||
/*
|
||||
* the current position in the tab of the last newest input recorded
|
||||
* This should never bee accessed outside of this class.
|
||||
*/
|
||||
private int pos;
|
||||
|
||||
|
||||
/**
|
||||
* base constructor of the InputBuffer. Creates a buffer of size 1, with every input empty
|
||||
*/
|
||||
public InputBuffer() {
|
||||
this.size = 1;
|
||||
this.pos = 0;
|
||||
this.inputList = new Inputs[1];
|
||||
}
|
||||
|
||||
public InputBuffer(int size) {
|
||||
this.size = size;
|
||||
this.pos = 0;
|
||||
this.inputList = new Inputs[this.size];
|
||||
|
||||
for(int i = 0; i < this.size; i++) {
|
||||
this.inputList[i] = new Inputs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the latest added inputs
|
||||
*/
|
||||
public Inputs getLatestInputs() {
|
||||
return this.inputList[this.pos];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the last input without moving the current position
|
||||
* @param inputs
|
||||
*/
|
||||
private void setLatestInputs(Inputs inputs) {
|
||||
this.inputList[pos] = inputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* advances the current position to the next one (goes back to the first if at the end
|
||||
*/
|
||||
private void nextPos() {
|
||||
this.pos++;
|
||||
if(this.pos == size) {this.pos = 0;}
|
||||
}
|
||||
|
||||
/**
|
||||
* record a new input in the
|
||||
* @param inputs a size 8 tab of inputs
|
||||
*/
|
||||
public void recordInputs(Inputs inputs) {
|
||||
this.nextPos();
|
||||
this.setLatestInputs(inputs);
|
||||
}
|
||||
|
||||
/**
|
||||
* records the new Inputs from a gamepad in the gamepad buffer
|
||||
* @param pad the gamepad to record
|
||||
* @param facesRight whether the character faces right or not, to know which way is forward
|
||||
*/
|
||||
public void recordInputsFromGamepad(GamepadInput pad, boolean facesRight) {
|
||||
Inputs in = new Inputs();
|
||||
in.recordFromGamepad(pad, facesRight);
|
||||
this.recordInputs(in);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for a command to be recognized. The last input of the command has to have been input on the current frame
|
||||
* @param command
|
||||
* @return true if the command is recognized,false if not
|
||||
*/
|
||||
public boolean commandRecognized(ButtonIG[][] command) {
|
||||
boolean ret = true;
|
||||
int backCounter;
|
||||
int startFrameCount = this.pos;
|
||||
int frameToCheck;
|
||||
try {
|
||||
ret = this.inputList[pos].containsButtonTab(command[command.length - 1]);
|
||||
} catch (ArrayIndexOutOfBoundsException e ) {
|
||||
return false;
|
||||
}
|
||||
for(int i = command.length - 2; i >= 0 && ret; i--) {
|
||||
backCounter = 1;
|
||||
if(startFrameCount - backCounter < 0) {frameToCheck = this.size - (backCounter - startFrameCount);}
|
||||
else {frameToCheck = startFrameCount - backCounter;}
|
||||
boolean search = true;
|
||||
while(ret && search) {
|
||||
if(this.inputList[frameToCheck].equalsButtonTab(command[i])) {
|
||||
ret = true;
|
||||
search = false;
|
||||
} else {
|
||||
if(backCounter >= pastFramesToCheck) {
|
||||
ret = false;
|
||||
search = false;
|
||||
}
|
||||
else {
|
||||
backCounter++;
|
||||
if(startFrameCount - backCounter < 0) {frameToCheck = this.size - (backCounter - startFrameCount);}
|
||||
else {frameToCheck = startFrameCount - backCounter;}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
startFrameCount = frameToCheck;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the inputbuffer. Clears every recorded input and puts the position back to 0.
|
||||
*/
|
||||
public void clear(){
|
||||
for(int i = 0; i < this.size; i++) {
|
||||
this.inputList[i].clear();
|
||||
}
|
||||
this.pos = 0;
|
||||
}
|
||||
|
||||
public Inputs[] getInputList(){
|
||||
return inputList;
|
||||
}
|
||||
|
||||
public int getPos(){
|
||||
return pos;
|
||||
}
|
||||
|
||||
public int getSize(){
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
134
src/main/java/gameplay/input/Inputs.java
Normal file
@ -0,0 +1,134 @@
|
||||
package gameplay.input;
|
||||
|
||||
import engine.input.GamepadInput;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
import static engine.input.InputConst.*;
|
||||
import static gameplay.input.ButtonIG.*;
|
||||
|
||||
/**
|
||||
* The class handling the parsing of one input.
|
||||
* @author Victor
|
||||
*
|
||||
*/
|
||||
public class Inputs {
|
||||
private static final int numberOfInputs = 8;
|
||||
private boolean[] tab;
|
||||
|
||||
public Inputs() {
|
||||
this.tab = new boolean[numberOfInputs];
|
||||
for(int i = 0; i < numberOfInputs; i ++) {
|
||||
this.tab[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* record one input
|
||||
* @param b the input to be recorded
|
||||
*/
|
||||
public void recordOneInput(ButtonIG b) {
|
||||
int i = b.toInt();
|
||||
this.tab[i] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a specific input (for example UP) has been recorded
|
||||
* @param b the button to be checked
|
||||
* @return
|
||||
*/
|
||||
public boolean containsInput(ButtonIG b) {
|
||||
return this.tab[b.toInt()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a number of inputs are contained simultaneously
|
||||
* @param in a number of inputs. Check if those are containes in this
|
||||
* @return true if all inputs of in are also in this
|
||||
*/
|
||||
public boolean containsInputs(Inputs in) {
|
||||
for(int i = 0; i < numberOfInputs; i++) {
|
||||
if(this.tab[i] != in.getInputs()[i]) {return false;}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a number of inputs are contained simultaneously, in the form of an array of Buttons
|
||||
* @param bs a number of inputs. Check if those are contained in this
|
||||
* @return true if all inputs of in are also in this
|
||||
*/
|
||||
public boolean containsButtonTab(ButtonIG[] bs) {
|
||||
for(int i = 0; i < bs.length; i++) {
|
||||
if(!this.containsInput(bs[i])) { return false;}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a number of inputs are contained simultaneously, in the form of an array of Buttons.
|
||||
* Contrary to the other containsButtonTab, will check that only these specified buttons are pressed.
|
||||
* @param bs a number of inputs. Check if those are contained in this
|
||||
* @return true if all inputs of in are also in this
|
||||
*/
|
||||
public boolean equalsButtonTab(ButtonIG[] bs) {
|
||||
ButtonIG[] directions = {DOWN,FORWARD,UP,BACK};
|
||||
ButtonIG[] buttons = {A,B,C,D};
|
||||
Inputs inp = new Inputs();
|
||||
for(int i = 0; i < bs.length; i++) {
|
||||
inp.recordOneInput(bs[i]);
|
||||
}
|
||||
if(!this.containsButtonTab(bs)){return false;}
|
||||
for(ButtonIG d : directions) {
|
||||
if(!this.containsInput(d) && inp.containsInput(d)) { return false;}
|
||||
if(this.containsInput(d) && !inp.containsInput(d)) { return false;}
|
||||
}
|
||||
for(ButtonIG d : buttons) {
|
||||
if(!this.containsInput(d) && inp.containsInput(d)) { return false;}
|
||||
if(this.containsInput(d) && !inp.containsInput(d)) { return false;}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean[] getInputs() {
|
||||
return this.tab;
|
||||
}
|
||||
|
||||
public void recordFromGamepad(GamepadInput pad, boolean facesRight) {
|
||||
int leftStickPadDir = pad.getAxisDiscreet(leftJoyX_Axe);
|
||||
// On check les directions du stick mtn pour eviter les répétitions comme les diagonales sont exclusive on les check aussi
|
||||
boolean check_pressed_left = pad.checkPressed(left) || leftStickPadDir == UPPER_LEFT ||leftStickPadDir == LEFT || leftStickPadDir == LOWER_LEFT;
|
||||
boolean check_pressed_right = pad.checkPressed(right) || leftStickPadDir == UPPER_RIGHT ||leftStickPadDir == RIGHT || leftStickPadDir == LOWER_RIGHT;
|
||||
|
||||
this.tab[ButtonIG.UP.toInt()] = pad.checkPressed(up) || leftStickPadDir == UP_STICK || leftStickPadDir == UPPER_LEFT || leftStickPadDir == UPPER_RIGHT;
|
||||
this.tab[DOWN.toInt()] = pad.checkPressed(down) || leftStickPadDir == DOWN_STICK || leftStickPadDir == LOWER_LEFT || leftStickPadDir == LOWER_RIGHT;;
|
||||
this.tab[ButtonIG.BACK.toInt()] = (check_pressed_left && facesRight) || (check_pressed_right &&!facesRight);
|
||||
this.tab[FORWARD.toInt()] = (check_pressed_right && facesRight) || (check_pressed_left && !facesRight);
|
||||
this.tab[ButtonIG.A.toInt()] = pad.checkPressed(buttonX);
|
||||
this.tab[ButtonIG.B.toInt()] = pad.checkPressed(buttonA);
|
||||
this.tab[ButtonIG.C.toInt()] = pad.checkPressed(buttonY);
|
||||
this.tab[ButtonIG.D.toInt()] = pad.checkPressed(buttonB);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String s = "";
|
||||
for(int i = 0; i < numberOfInputs; i++) {
|
||||
if(this.tab[i]) {s = s + ButtonIG.intToButton(i).toString() + " "; }
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the input (puts them all to false)
|
||||
*/
|
||||
public void clear(){
|
||||
for(int i = 0; i < numberOfInputs; i++) {
|
||||
this.tab[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean[] getTab(){
|
||||
return tab;
|
||||
}
|
||||
|
||||
}
|
877
src/main/java/gameplay/match/match.java
Normal file
@ -0,0 +1,877 @@
|
||||
package gameplay.match;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.gui.UIElement;
|
||||
import engine.gui.UIElementText;
|
||||
import engine.gui.UIInputList;
|
||||
import engine.input.GamepadInput;
|
||||
import engine.math.Vector3f;
|
||||
import engine.object.Hitbox;
|
||||
import engine.object.HorizontalProgressBar;
|
||||
import engine.object.ObjectGl;
|
||||
import engine.object.Sprite;
|
||||
import gameplay.Characters.Blue.CharacterBlue;
|
||||
import gameplay.actions.Attack;
|
||||
import gameplay.actions.attackPart;
|
||||
import gameplay.actions.ThrowPart;
|
||||
import gameplay.entities.Status;
|
||||
import gameplay.frames.Frame;
|
||||
import gameplay.hitboxes.*;
|
||||
import gameplay.input.InputBuffer;
|
||||
import gameplay.entities.Character;
|
||||
import gameplay.input.Inputs;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Main class that describes the base structure of the match, with characters, timer and such
|
||||
* @author Victor Azra
|
||||
*
|
||||
*/
|
||||
public class match {
|
||||
|
||||
/**
|
||||
* the number of inputs read for each character, a.k.a. for how many frames the inputs are saved in memory.
|
||||
*/
|
||||
private static final int inputBufferSize = 120;
|
||||
|
||||
/**
|
||||
* the level of the "ground", used to determine if a character is in the air or not.
|
||||
*/
|
||||
private static final int groundLevel = 180;
|
||||
|
||||
private static int timer;
|
||||
private static InputBuffer inputsP1, inputsP2;
|
||||
private static int roundsWonP1=0, roundsWonP2=0;
|
||||
private static Character p1, p2; //characters of player 1 and 2
|
||||
|
||||
private static long timeStamp1;
|
||||
private static long timeStamp2;
|
||||
private static int frameCount;
|
||||
private static int oldPosXp1;
|
||||
private static int oldPosXp2;
|
||||
private static int oldPosYp1;
|
||||
private static int oldPosYp2;
|
||||
private static GamepadInput gamepad1 = null;
|
||||
private static GamepadInput gamepad2 = null;
|
||||
|
||||
// GUI / HUD ?
|
||||
private static UIElementText coordP1;
|
||||
private static UIElementText coordP2;
|
||||
private static UIElement healthBarP1;
|
||||
private static UIElement healthBarP2;
|
||||
private static HorizontalProgressBar healthBarP1Obj;
|
||||
private static HorizontalProgressBar healthBarP2Obj;
|
||||
private static UIElementText timerUI;
|
||||
private static UIElementText fpsCounter;
|
||||
private static UIInputList inputListP1;
|
||||
private static UIElementText matchWon;
|
||||
|
||||
// Debug
|
||||
public static boolean showP1Hitbox;
|
||||
public static boolean showP2Hitbox;
|
||||
private static List<Hitbox> listHitboxObj = new ArrayList<>();
|
||||
private static float slowFactor = 1f;
|
||||
private static long timeStampFpsCounter;
|
||||
private static int frameCounter;
|
||||
private static int roundCounter=0;
|
||||
|
||||
private static Sprite objP1,objP2;
|
||||
private static Engine engine;
|
||||
private static Frame f;
|
||||
private static int acCode = 0;
|
||||
private static boolean roundP1=false;
|
||||
|
||||
// Settings
|
||||
private static int height, width, rounds;
|
||||
private static String character1, character2, stage;
|
||||
private static boolean fullscreen;
|
||||
|
||||
|
||||
/**
|
||||
* Starts a new round, by placing the timer back at base value, characters back at full hp and such.
|
||||
*/
|
||||
private static void startNewRound() {
|
||||
timer = 99;
|
||||
inputsP1 = new InputBuffer(inputBufferSize);
|
||||
inputsP2 = new InputBuffer(inputBufferSize);
|
||||
p1.setPos(-750, groundLevel); //TODO : change to better values if needed
|
||||
p2.setPos((int) (750 - objP2.getWidth() * objP2.getScalingFactor()), groundLevel); //TODO : change to better values if needed
|
||||
p1.setCurrentHP(p1.getMaxHP());
|
||||
p2.setCurrentHP(p2.getMaxHP());
|
||||
objP1.translate(new Vector3f(p1.getPosX(),p1.getPosY(),0));
|
||||
objP2.translate(new Vector3f(p2.getPosX(),p2.getPosY(),0));
|
||||
// TODO meilleur implémentation possible
|
||||
objP1.getShadow().translate(new Vector3f(0f,p1.getPosY(),0));
|
||||
objP2.getShadow().translate(new Vector3f(0f,p2.getPosY(),0));
|
||||
// Crée l'InputList
|
||||
inputListP1 = new UIInputList(inputsP1, 10f, 0f, 0.85f, 110f, engine);
|
||||
engine.add_uiElement(inputListP1);
|
||||
inputListP1.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends the round.
|
||||
* Used for playing animations and such.
|
||||
*/
|
||||
private static void endRound() {
|
||||
roundCounter++;
|
||||
String victoryTxt = roundP1 ? "Player1 won the round"+roundCounter : "Player2 won the round"+roundCounter;
|
||||
|
||||
System.out.println(victoryTxt);
|
||||
matchWon = new UIElementText(victoryTxt, 5f, 0.25f, 0.5f, 200f, engine);
|
||||
matchWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true);
|
||||
engine.add_uiElement(matchWon);
|
||||
|
||||
timeStamp1 = System.currentTimeMillis();
|
||||
while(System.currentTimeMillis() - timeStamp1 < 2500){
|
||||
engine.update();
|
||||
engine.render();
|
||||
}
|
||||
|
||||
engine.remove_uiElement(matchWon);
|
||||
|
||||
//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));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends the match.
|
||||
* Used for playing animations and such.
|
||||
* TODO : Implement this once we know what to do.
|
||||
*/
|
||||
private static void endMatch() {
|
||||
String victoryTxt = roundsWonP1 > roundsWonP2 ? "P1 won the match" : "P2 won the match";
|
||||
|
||||
matchWon = new UIElementText(victoryTxt, 5f, 0.25f, 0.5f, 200f, engine);
|
||||
matchWon.setShader("shaders/StylishShaders/WavyTextVert.glsl", "shaders/StylishShaders/TextFrag.glsl", true, true);
|
||||
engine.add_uiElement(matchWon);
|
||||
|
||||
timeStamp1 = System.currentTimeMillis();
|
||||
while(System.currentTimeMillis() - timeStamp1 < 2500){
|
||||
engine.update();
|
||||
engine.render();
|
||||
}
|
||||
|
||||
engine.setRunning(false);
|
||||
}
|
||||
public static void parse() throws FileNotFoundException {
|
||||
|
||||
JSONParser jsonP = new JSONParser();
|
||||
try {
|
||||
JSONObject jsonO = (JSONObject) jsonP.parse(new FileReader("game.set"));
|
||||
JSONArray game = (JSONArray) jsonO.get("game");
|
||||
JSONObject settings = (JSONObject) game.get(0);
|
||||
|
||||
height = Integer.parseInt((String) settings.get("height"));
|
||||
width = Integer.parseInt((String) settings.get("width"));
|
||||
fullscreen = Boolean.parseBoolean((String) settings.get("fullscreen"));
|
||||
rounds = Integer.parseInt((String) settings.get("rounds"));
|
||||
character1 = (String) settings.get("character1");
|
||||
character2 = (String) settings.get("character2");
|
||||
stage = (String) settings.get("stage");
|
||||
showP1Hitbox = Boolean.parseBoolean((String) settings.get("hitboxes"));
|
||||
showP2Hitbox = showP1Hitbox;
|
||||
} catch (ParseException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
parse();
|
||||
engine = new Engine(width, height, fullscreen, new Vector3f(4.0f, 3.0f));
|
||||
engine.init();
|
||||
|
||||
boolean Joystick1Present = glfwJoystickPresent(GLFW_JOYSTICK_1);
|
||||
boolean Joystick2Present = glfwJoystickPresent(GLFW_JOYSTICK_2);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
f = p1.getCurrentframe();
|
||||
objP1.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]);
|
||||
|
||||
f = p2.getCurrentframe();
|
||||
objP2.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]);
|
||||
objP2.flipTextureWrapH();
|
||||
|
||||
//Création des ombres
|
||||
objP1.setShadow();
|
||||
engine.add_objectGl(objP1.getShadow());
|
||||
objP2.setShadow();
|
||||
engine.add_objectGl(objP2.getShadow());
|
||||
|
||||
if(Joystick1Present) {
|
||||
gamepad1 = new GamepadInput(GLFW_JOYSTICK_1);
|
||||
gamepad1.inputRefresh();
|
||||
System.out.println("P1 Controller: " + gamepad1.getGamepadName());
|
||||
}
|
||||
if(Joystick2Present) {
|
||||
gamepad2 = new GamepadInput(GLFW_JOYSTICK_2);
|
||||
gamepad2.inputRefresh();
|
||||
System.out.println("P2 Controller: " + gamepad2.getGamepadName());
|
||||
}
|
||||
|
||||
/*
|
||||
GUI Setup
|
||||
*/
|
||||
coordP1 = new UIElementText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY(), 5f, 0f, 0.15f, 70f, engine);
|
||||
coordP1.setBackground(new Vector3f(0f,0f,0f));
|
||||
engine.add_uiElement(coordP1);
|
||||
coordP2 = new UIElementText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P1: " + p2.getPosX() +":" + p2.getPosY(), 5f, 0f, 0.1f, 70f, engine);
|
||||
coordP2.setBackground(new Vector3f(0f,0f,0f));
|
||||
engine.add_uiElement(coordP2);
|
||||
// Barre de vie
|
||||
healthBarP1Obj = new HorizontalProgressBar(80f, 8.5f, 0.4f, 100f, p1.getCurrentHP(), p1.getMaxHP(), false);
|
||||
healthBarP1Obj.setShader("/shaders/StylishShaders/BasicNoTexVert.glsl", "/shaders/StylishShaders/HorizontalProgressBarGradientSquareFrag.glsl");
|
||||
healthBarP1Obj.setUseHeight(true);
|
||||
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.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);
|
||||
// Habillage barre de vie
|
||||
ObjectGl healthBarP1Hab = new ObjectGl(81f, 1f, 1f, 1f, "/textures/health_bar.png", null);
|
||||
healthBarP1Hab.setTextureWrap(0,0, 883, 158);
|
||||
UIElement healthBarP1HabUI = new UIElement(healthBarP1Hab, 0.005f, 0.995f, engine);
|
||||
engine.add_uiElement(healthBarP1HabUI);
|
||||
ObjectGl healthBarP2Hab = new ObjectGl(81f, 1f, 1f, 1f, "/textures/health_bar.png", null);
|
||||
healthBarP2Hab.setTextureWrap(0,0, 883, 158);
|
||||
healthBarP2Hab.flipTextureWrapH();
|
||||
UIElement healthBarP2HabUI = new UIElement(healthBarP2Hab, 0.555f, 0.995f, engine);
|
||||
engine.add_uiElement(healthBarP2HabUI);
|
||||
// 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);
|
||||
|
||||
while(frameCount < 5940 && engine.getRunning()) {
|
||||
ac(acCode);
|
||||
if(engine.shouldClose()) engine.setRunning(false);
|
||||
}
|
||||
|
||||
engine.setRunning(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void ac(int i) throws InterruptedException {
|
||||
// System.out.println(i);
|
||||
switch (i) {
|
||||
|
||||
//initiate a round
|
||||
case 0 :
|
||||
startNewRound();
|
||||
timeStamp1 = System.currentTimeMillis();
|
||||
frameCount = 0;
|
||||
acCode = 10;
|
||||
break;
|
||||
|
||||
//checks if one or both of the chars are out of health
|
||||
case 10:
|
||||
oldPosXp1 = p1.getPosX();
|
||||
oldPosXp2 = p2.getPosX();
|
||||
oldPosYp1 = p1.getPosY();
|
||||
oldPosYp2 = p2.getPosY();
|
||||
|
||||
if(p1.getCurrentHP() <= 0 && p2.getCurrentHP() <= 0) { acCode = 11;}
|
||||
else if(p1.getCurrentHP() <= 0) { acCode = 12;}
|
||||
else if(p2.getCurrentHP() <= 0) { acCode = 13;}
|
||||
else { acCode = 20;}
|
||||
break;
|
||||
|
||||
//end round
|
||||
case 11:
|
||||
endRound();
|
||||
if(roundsWonP1 >= (rounds/2 +1) || roundsWonP2 >= (rounds/2 +1)) { endMatch();} //TODO : will probably need to specify more
|
||||
acCode = 0;
|
||||
break;
|
||||
|
||||
//if p1 is at 0 health
|
||||
case 12:
|
||||
roundsWonP2++;
|
||||
roundP1 =false;
|
||||
acCode = 11;
|
||||
break;
|
||||
|
||||
//if p2 is at 0 health
|
||||
case 13:
|
||||
roundsWonP1++;
|
||||
roundP1=true;
|
||||
acCode = 11;
|
||||
break;
|
||||
|
||||
//read both players inputs
|
||||
case 20:
|
||||
if (glfwJoystickPresent(GLFW_JOYSTICK_1)) {
|
||||
gamepad1.inputRefresh();
|
||||
inputsP1.recordInputsFromGamepad(gamepad1, p1.getPosX() < p2.getPosX());
|
||||
handleInputs(p1, inputsP1);
|
||||
}
|
||||
if (glfwJoystickPresent(GLFW_JOYSTICK_2)) {
|
||||
gamepad2.inputRefresh();
|
||||
inputsP2.recordInputsFromGamepad(gamepad2, p2.getPosX() <= p1.getPosX());
|
||||
handleInputs(p2, inputsP2);
|
||||
}
|
||||
|
||||
//
|
||||
acCode = 21;
|
||||
break;
|
||||
|
||||
//start of the handling of hitboxes
|
||||
case 21:
|
||||
try {
|
||||
handleThrows(p1, p2);
|
||||
handleThrows(p2,p1);
|
||||
} catch (IndexOutOfBoundsException e) {}
|
||||
try {
|
||||
handleHits(p1, p2, inputsP2);
|
||||
handleHits(p2, p1, inputsP1);
|
||||
}catch (IndexOutOfBoundsException e) {};
|
||||
acCode = 22;
|
||||
break;
|
||||
|
||||
//Update of the current frame of each character
|
||||
case 22:
|
||||
|
||||
if(p1.getCurrentframe().islastFrameOfHit()) {
|
||||
p1.removeFirstAttackPart();
|
||||
}
|
||||
if(p2.getCurrentframe().islastFrameOfHit()) {
|
||||
p2.removeFirstAttackPart();
|
||||
}
|
||||
nextFrame(p1,inputsP1);
|
||||
nextFrame(p2,inputsP2);
|
||||
|
||||
boolean p1LooksRight = p1.getPosX() < p2.getPosX();
|
||||
updatePos(p1,p1LooksRight);
|
||||
updatePos(p2,!p1LooksRight);
|
||||
|
||||
pushBox();
|
||||
|
||||
cameraPushBack();
|
||||
|
||||
if(p1LooksRight) {
|
||||
|
||||
f = p1.getCurrentframe();
|
||||
objP1.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]);
|
||||
objP1.translate(new Vector3f(p1.getPosX()-oldPosXp1,p1.getPosY()-oldPosYp1,0));
|
||||
|
||||
f = p2.getCurrentframe();
|
||||
objP2.setTextureWrap(f.getSprite()[0], f.getSprite()[1], f.getSprite()[2], f.getSprite()[3]);
|
||||
objP2.translate(new Vector3f(p2.getPosX() - oldPosXp2,p2.getPosY()-oldPosYp2,0));
|
||||
|
||||
Frame nf = new Frame();
|
||||
nf.clone(p2.getCurrentframe());
|
||||
nf.invertHitBoxes();
|
||||
p2.setCurrentFrame(nf);
|
||||
objP2.flipTextureWrapH();
|
||||
|
||||
} else {
|
||||
|
||||
Frame p1f = p1.getCurrentframe();
|
||||
objP1.setTextureWrap(p1f.getSprite()[0], p1f.getSprite()[1], p1f.getSprite()[2], p1f.getSprite()[3]);
|
||||
objP1.translate(new Vector3f(p1.getPosX()-oldPosXp1,p1.getPosY()-oldPosYp1,0));
|
||||
|
||||
Frame p2f = p2.getCurrentframe();
|
||||
objP2.setTextureWrap(p2f.getSprite()[0], p2f.getSprite()[1], p2f.getSprite()[2], p2f.getSprite()[3]);
|
||||
objP2.translate(new Vector3f(p2.getPosX()-oldPosXp2,p2.getPosY()-oldPosYp2,0));
|
||||
|
||||
Frame nf = new Frame();
|
||||
nf.clone(p1.getCurrentframe());
|
||||
nf.invertHitBoxes();
|
||||
p1.setCurrentFrame(nf);
|
||||
objP1.flipTextureWrapH();
|
||||
}
|
||||
|
||||
engine.cameraTracking();
|
||||
|
||||
// Debug Hitbox Management
|
||||
removeHitboxEngine();
|
||||
if (showP1Hitbox){
|
||||
addHitbox(p1);
|
||||
} if (showP2Hitbox) {
|
||||
addHitbox(p2);
|
||||
}
|
||||
addHitboxEngine();
|
||||
|
||||
engine.update();
|
||||
engine.render();
|
||||
acCode = 23;
|
||||
break;
|
||||
|
||||
//Waits the end of 1/60th of a second since start of frame then loops back to start
|
||||
case 23:
|
||||
// GUI update here
|
||||
coordP1.setText("objP1: " + objP1.getXPos() + ":" + objP1.getYPos() + " P1: " + p1.getPosX() +":" + p1.getPosY());
|
||||
coordP2.setText("objP2: " + objP2.getXPos() + ":" + objP2.getYPos() + " P2: " + p2.getPosX() +":" + p2.getPosY());
|
||||
healthBarP1Obj.setCurrent(p1.getCurrentHP()); healthBarP1Obj.setMax(p1.getMaxHP());
|
||||
healthBarP2Obj.setCurrent(p2.getCurrentHP()); healthBarP2Obj.setMax(p2.getMaxHP());
|
||||
timerUI.setText(timer + "");
|
||||
|
||||
timer = 99 - frameCount/60;
|
||||
|
||||
timeStamp2 = System.currentTimeMillis();
|
||||
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;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will handle the inputs recorder and have the character do a corresponding action if possible
|
||||
* Order of priority is Throw > Special > Normal > Jump > Dash > Crouch > Move > do nothing
|
||||
* @param c
|
||||
* @param input
|
||||
*/
|
||||
private static void handleInputs(Character c, InputBuffer input) {
|
||||
Inputs latestIn = input.getLatestInputs();
|
||||
boolean actionSet = false;
|
||||
if(latestIn.containsButtonTab(c.getNormalthrow().getCommand()[0]) && c.getCurrentframe().isNormalCancellable()) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFramesList(c.getNormalthrow().getFrame());
|
||||
actionSet = true;
|
||||
} else {
|
||||
int atkCount = 0;
|
||||
//do an attack if possible
|
||||
while(atkCount < c.getAttacks().length && !actionSet) {
|
||||
Attack atk = c.getAttacks()[atkCount];
|
||||
boolean attackIsPossible = input.commandRecognized(atk.getCommand())
|
||||
&& atk.getRequiredStatus().equals(c.getStatus())
|
||||
&& ((atk.isSpecial() && c.getCurrentframe().isSpecialCancellable())
|
||||
|| (!atk.isSpecial() && c.getCurrentframe().isNormalCancellable()));
|
||||
if(attackIsPossible) {
|
||||
if(c.getStatus() == Status.JUMPING) {
|
||||
ArrayList<Frame> af = new ArrayList<>(c.getFrames());
|
||||
c.clearNextFrames();
|
||||
for(int i = 0; (i < af.size() - 1) && (i < atk.getFrame().size()); i++) {
|
||||
Frame jumpf = af.get(i+1);
|
||||
jumpf.cloneWithoutMovement(atk.getFrame().get(i));
|
||||
c.addSingleFrame(jumpf);
|
||||
}
|
||||
c.setAttackPartsArray(atk.getParts());
|
||||
}
|
||||
else {
|
||||
c.clearNextFrames();
|
||||
c.addNextFramesList(atk.getFrame());
|
||||
c.setAttackPartsArray(atk.getParts());
|
||||
}
|
||||
actionSet = true;
|
||||
}
|
||||
atkCount++;
|
||||
}
|
||||
if(c.getCurrentframe().isJumpCancellable() && !actionSet) {
|
||||
if (input.commandRecognized(c.getForwardJump().getCommand())) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFramesList(c.getForwardJump().getFrame());
|
||||
actionSet = true;
|
||||
c.setStatus(Status.JUMPING);
|
||||
} else if (input.commandRecognized(c.getBackJump().getCommand())) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFramesList(c.getBackJump().getFrame());
|
||||
actionSet = true;
|
||||
c.setStatus(Status.JUMPING);
|
||||
} else if (input.commandRecognized(c.getNeutralJump().getCommand())) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFramesList(c.getNeutralJump().getFrame());
|
||||
actionSet = true;
|
||||
c.setStatus(Status.JUMPING);
|
||||
}
|
||||
}
|
||||
if(c.getCurrentframe().isDashCancellable() && !actionSet) {
|
||||
if (input.commandRecognized(c.getForwardDash().getCommand())) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFramesList(c.getForwardDash().getFrame());
|
||||
actionSet = true;
|
||||
} else if (input.commandRecognized(c.getBackDash().getCommand())) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFramesList(c.getBackDash().getFrame());
|
||||
actionSet = true;
|
||||
}
|
||||
}
|
||||
if(c.getCurrentframe().isMoveCancellable() && !actionSet) {
|
||||
if(input.getLatestInputs().containsInput(ButtonIG.DOWN)) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFrames(c.getDefaultCrouchingFrames());
|
||||
} else if(input.getLatestInputs().containsInput(ButtonIG.BACK)) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFrames(c.getBackWalkFrames());
|
||||
} if(input.getLatestInputs().containsInput(ButtonIG.FORWARD)) {
|
||||
c.clearNextFrames();
|
||||
c.addNextFrames(c.getForwardWalkFrames());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void handleThrows(Character p1, Character p2) {
|
||||
ArrayList<Active_throw_Hitbox> activeP1 = new ArrayList<>(p1.getCurrentframe().getActThrowHitBox());
|
||||
ArrayList<Passive_throw_HitBox> passiveP2 = new ArrayList<>(p2.getCurrentframe().getPassThrowHitBox());
|
||||
ArrayList<ThrowPart> tP = new ArrayList<>(p1.getNextThrowParts());
|
||||
ThrowPart hit = new ThrowPart(tP.get(0).getFrames());
|
||||
hit.clone(tP.get(0));
|
||||
for(Active_throw_Hitbox atH : activeP1) {
|
||||
for(Passive_throw_HitBox ptH : passiveP2) {
|
||||
if(!hit.hasHit()){
|
||||
boolean p1LooksRight = p1.getPosX() < p2.getPosX();
|
||||
boolean touchH = (p1LooksRight && (atH.getPosX()+p1.getPosX()+ atH.getSize_x() > ptH.getPosX()+p2.getPosX()+ptH.getSize_x())
|
||||
&& (atH.getPosX() < ptH.getPosX()))
|
||||
|| (!p1LooksRight && (atH.getPosX()+p1.getPosX()+ atH.getSize_x() < ptH.getPosX()+p2.getPosX()+ptH.getSize_x())
|
||||
&& (atH.getPosX() > ptH.getPosX()));
|
||||
|
||||
|
||||
boolean touchV = (atH.getPosY()+p1.getPosY() - atH.getSize_y() < ptH.getPosY()+p2.getPosY()) && (atH.getPosY()+p1.getPosY() > ptH.getPosY()+p2.getPosY() - ptH.getSize_y());
|
||||
|
||||
if(touchH && touchV) {
|
||||
hit.setHasHit(true);
|
||||
tP.set(0,hit);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* handles the if the first character hits the second one
|
||||
* @param p1 the character whose hits to handle
|
||||
* @param p2 the character who is or isn't hit
|
||||
* @param inputsP2 the inputs of the player 2, used to see if they're guarding
|
||||
*/
|
||||
private static void handleHits(Character p1, Character p2, InputBuffer inputsP2) {
|
||||
ArrayList<Active_HitBox> activeP1 = new ArrayList<>(p1.getCurrentframe().getActHitBox());
|
||||
ArrayList<Passive_HitBox> passiveP2 = new ArrayList<>(p2.getCurrentframe().getPassHitBox());
|
||||
ArrayList<attackPart> aP = new ArrayList<>(p1.getNextAttackParts());
|
||||
attackPart hit = new attackPart(aP.get(0).getFrames());
|
||||
hit.clone(aP.get(0));
|
||||
for(Active_HitBox aH : activeP1) {
|
||||
for(Passive_HitBox pH : passiveP2) {
|
||||
if(!hit.hasHit()){
|
||||
boolean p1LooksRight = p1.getPosX() < p2.getPosX();
|
||||
boolean touchH = (p1LooksRight && (aH.getPosX()+p1.getPosX()+ aH.getSize_x() > pH.getPosX()+p2.getPosX()+pH.getSize_x())
|
||||
&& (aH.getPosX() < pH.getPosX()))
|
||||
|| (!p1LooksRight && (aH.getPosX()+p1.getPosX()+ aH.getSize_x() < pH.getPosX()+p2.getPosX()+pH.getSize_x())
|
||||
&& (aH.getPosX() > pH.getPosX()));
|
||||
|
||||
|
||||
boolean touchV = (aH.getPosY()+p1.getPosY() - aH.getSize_y() < pH.getPosY()+p2.getPosY()) && (aH.getPosY()+p1.getPosY() > pH.getPosY()+p2.getPosY() - pH.getSize_y());
|
||||
|
||||
if(touchH && touchV) {
|
||||
getHit(p2,hit,inputsP2.getLatestInputs());
|
||||
hit.setHasHit(true);
|
||||
aP.set(0,hit);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handles a character getting hit by an attack part.
|
||||
* @param c the character that's getting hit
|
||||
* @param aP the attackPart hitting the character
|
||||
* @param inputs the current inputs of c
|
||||
*/
|
||||
private static void getHit(Character c, attackPart aP, Inputs inputs) {
|
||||
boolean getsHit = (c.getStatus() == Status.JUMPING) || (c.getStatus() == Status.HITINAIR) || (c.getStatus() == Status.FALLING)
|
||||
|| !inputs.containsInput(ButtonIG.BACK)
|
||||
|| (aP.isLow() && !inputs.containsInput(ButtonIG.DOWN))
|
||||
|| (aP.isOverHead() && inputs.containsInput(ButtonIG.DOWN));
|
||||
Frame[] nextFrames;
|
||||
c.clearNextFrames();
|
||||
if(getsHit) {
|
||||
switch (c.getStatus()) {
|
||||
case JUMPING: case HITINAIR: case FALLING :
|
||||
|
||||
nextFrames = new Frame[20];
|
||||
for(int i = 0; i < nextFrames.length; i++) {
|
||||
nextFrames[i] = c.getHitInAirFrame();
|
||||
}
|
||||
c.addNextFrames(nextFrames);
|
||||
c.reduceHP(aP.getDamage());
|
||||
c.setStatus(Status.HITINAIR);
|
||||
break;
|
||||
default :
|
||||
c.clearNextFrames();
|
||||
if(!aP.knocksDown()) {
|
||||
nextFrames = new Frame[aP.getHitstun()];
|
||||
if (inputs.containsInput(ButtonIG.DOWN)) {
|
||||
for (int i = 0; i < nextFrames.length; i++) {
|
||||
nextFrames[i] = c.getCrouchHitFrame();
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < nextFrames.length; i++) {
|
||||
nextFrames[i] = c.getStandHitFrame();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nextFrames = new Frame[c.getKnockedDownFrames().length];
|
||||
for (int i = 0; i < nextFrames.length; i++) {
|
||||
nextFrames[i] = c.getKnockedDownFrames()[i];
|
||||
}
|
||||
}
|
||||
c.addNextFrames(nextFrames);
|
||||
c.reduceHP(aP.getDamage());
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
nextFrames = new Frame[aP.getBlockstun()];
|
||||
if(inputs.containsInput(ButtonIG.DOWN)) {
|
||||
for(int i = 0; i < nextFrames.length; i++) {
|
||||
nextFrames[i] = c.getCrouchGuardFrame();
|
||||
}
|
||||
} else {
|
||||
for(int i = 0; i < nextFrames.length; i++) {
|
||||
nextFrames[i] = c.getStandGuardFrame();
|
||||
}
|
||||
}
|
||||
c.reduceHP(aP.getChipDamage());
|
||||
c.addNextFrames(nextFrames);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the character to its next logical frame
|
||||
* @param c the character
|
||||
* @param in the input buffer corresponding to the character
|
||||
*/
|
||||
private static void nextFrame(Character c, InputBuffer in) {
|
||||
c.goToNextFrames();
|
||||
if (c.getFrames().size() == 0) {
|
||||
switch(c.getStatus()) {
|
||||
case FALLING:case HITINAIR:
|
||||
if(c.getPosY() > groundLevel){
|
||||
c.setStatus(Status.FALLING);
|
||||
c.addSingleFrame(c.getFallingframe());
|
||||
} else {
|
||||
c.setPos(c.getPosX(),groundLevel);
|
||||
c.setStatus(Status.KNOCKEDDOWN);
|
||||
c.addNextFrames(c.getKnockedDownFrames());
|
||||
}
|
||||
break;
|
||||
case JUMPING:
|
||||
if(c.getPosY() > groundLevel) {
|
||||
c.addSingleFrame(c.getNeutralJump().getFrame().get(c.getNeutralJump().getFrame().size() - 1));
|
||||
} else {
|
||||
c.setPos(c.getPosX(),groundLevel);
|
||||
c.setStatus(Status.NORMAL);
|
||||
c.addNextFrames(c.getDefaultStandingFrames());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
c.setStatus(Status.NORMAL);
|
||||
if(in.getLatestInputs().containsInput(ButtonIG.DOWN)) {
|
||||
c.addNextFrames(c.getDefaultCrouchingFrames());
|
||||
}
|
||||
else {
|
||||
c.addNextFrames(c.getDefaultStandingFrames());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void updatePos(Character c, boolean looksRight) {
|
||||
if(looksRight) {c.setPos((int)(c.getPosX()+c.getCurrentframe().getMove_x()),(int)(c.getPosY()+c.getCurrentframe().getMove_y()));}
|
||||
else {c.setPos((int)(c.getPosX()-c.getCurrentframe().getMove_x()),(int)(c.getPosY()+c.getCurrentframe().getMove_y()));}
|
||||
}
|
||||
|
||||
private static void pushBox(){
|
||||
int push = 100;
|
||||
Push_HitBox phb1 = p1.getCurrentframe().getPushHitBox();
|
||||
Push_HitBox phb2 = p2.getCurrentframe().getPushHitBox();
|
||||
// Check if there is an intersection only on the x axis, if we push on the y axis character could get stuck in the air
|
||||
boolean lookRight = p1.getPosX() < p2.getPosX();
|
||||
float sizeIntersection = lookRight ? p1.getPosX() + phb1.getPosX() + phb1.getSize_x() - p2.getPosX() - phb2.getPosX()
|
||||
: p2.getPosX() + phb2.getPosX() + phb2.getSize_x() - p1.getPosX() - phb1.getPosX();
|
||||
boolean col = 0 < sizeIntersection;
|
||||
boolean colV = (phb1.getPosY() + p1.getPosY() - phb1.getSize_y() < phb2.getPosY() + p2.getPosY()) && (phb1.getPosY() + p1.getPosY() > phb2.getPosY() + p2.getPosY() - phb2.getSize_y());
|
||||
if (col && colV){
|
||||
if(lookRight){
|
||||
p1.setPos((int) (p1.getPosX() - sizeIntersection/2), p1.getPosY());
|
||||
p2.setPos((int) (p2.getPosX() + sizeIntersection/2), p2.getPosY());
|
||||
} else {
|
||||
p1.setPos((int) (p1.getPosX() + sizeIntersection/2), p1.getPosY());
|
||||
p2.setPos((int) (p2.getPosX() - sizeIntersection/2), p2.getPosY());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static void cameraPushBack(){
|
||||
boolean lookRight = p1.getPosX() < p2.getPosX();
|
||||
Character left;
|
||||
Character right;
|
||||
ObjectGl rightObj;
|
||||
if (lookRight) {
|
||||
left = p1;
|
||||
right = p2;
|
||||
rightObj = objP2;
|
||||
} else {
|
||||
left = p2;
|
||||
right = p1;
|
||||
rightObj = objP1;
|
||||
}
|
||||
|
||||
float leftOutOfView = left.getPosX() - (-engine.getViewXPos() - engine.getCamera().getDimension());
|
||||
float rightOutOfView = (right.getPosX() + rightObj.getWidth() * rightObj.getScalingFactor()) - (-engine.getViewXPos() + engine.getCamera().getDimension());
|
||||
|
||||
boolean leftOOB = left.getPosX() < -engine.getViewXPos() - engine.getCamera().getDimension();
|
||||
boolean rightOOB = right.getPosX() + rightObj.getWidth() * rightObj.getScalingFactor() > -engine.getViewXPos() + engine.getCamera().getDimension();
|
||||
|
||||
if(leftOOB && rightOutOfView - leftOutOfView > 0){
|
||||
left.setPos((int) (left.getPosX() - leftOutOfView), left.getPosY());
|
||||
}
|
||||
if(rightOOB && leftOutOfView - rightOutOfView < 0){
|
||||
right.setPos((int) (right.getPosX() - rightOutOfView), right.getPosY());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
HITBOX DEBUG METHOD
|
||||
*/
|
||||
|
||||
|
||||
private static void addHitboxEngine(){
|
||||
for (ObjectGl obj : listHitboxObj){
|
||||
engine.add_objectGl(obj);
|
||||
}
|
||||
}
|
||||
|
||||
private static void removeHitboxEngine(){
|
||||
for (ObjectGl obj : listHitboxObj){ // Il faut le cast en ObjectGl
|
||||
engine.remove_objectGl(obj);
|
||||
}
|
||||
listHitboxObj = new ArrayList<>();
|
||||
}
|
||||
|
||||
private static void addHitbox(Character c){
|
||||
Frame f = c.getCurrentframe();
|
||||
Vector3f posC = new Vector3f(c.getPosX(), c.getPosY(), 100f);
|
||||
Vector3f darkBlue = new Vector3f(8f/255f, 29f/255f, 153f/255f);
|
||||
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 + 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(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(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(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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
10
src/main/java/gameplay/match/sprite_zorder.txt
Normal file
@ -0,0 +1,10 @@
|
||||
0 - Background
|
||||
4 - P1 Shadow
|
||||
5 - P2 Shadow
|
||||
14 - P1
|
||||
15 - P2
|
||||
70 - Affichage des coordonnées
|
||||
80 - Barre de vie
|
||||
81 - Habillage barre de vie
|
||||
85 - Timer
|
||||
1000 +
|
313
src/main/java/launcher/Launcher.java
Normal file
@ -0,0 +1,313 @@
|
||||
package launcher;
|
||||
|
||||
import gameplay.match.*;
|
||||
import javafx.application.Application;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
import javafx.fxml.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>Game configuration window and engine launcher</p>
|
||||
* @author François Autin
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class Launcher extends Application {
|
||||
|
||||
//public static Launcher pointer; // Self pointer, required to regain context if ever exited
|
||||
private static Settings setter; // Settings class allows manipulation of settings
|
||||
protected static HashMap<String, Object> arraysettings; // Array that allows passing values of UI elements to setter
|
||||
private static Map<String, Object> namespace; // Namespace containing all elements from UI
|
||||
|
||||
/**
|
||||
* Starts the Launcher thread
|
||||
*/
|
||||
public Launcher() {
|
||||
try {
|
||||
setter = new Settings();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
arraysettings = new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start method is used by Launcher as an implementation of the Application class to create a JavaFX thread to display the GUI window
|
||||
* @param primaryStage the base Stage on which to place UI elements
|
||||
* @throws IOException if the FXMLLoader fails to find or parse the launcher.fxml file
|
||||
* @author François Autin
|
||||
*/
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
|
||||
// Loading UI from FXML file
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("launcher.fxml"));
|
||||
Parent root = loader.load();
|
||||
Scene main = new Scene(root);
|
||||
|
||||
// Assigning pointer to namespace
|
||||
namespace = loader.getNamespace();
|
||||
|
||||
/******************/
|
||||
/* Resolution box */
|
||||
/******************/
|
||||
|
||||
// Getting resolution ChoiceBox object from namespace
|
||||
ChoiceBox<String> cb = (ChoiceBox<String>) namespace.get("resolution");
|
||||
// Assigning list of possible choices to ChoiceBox
|
||||
ObservableList<String> availableres = FXCollections.observableArrayList("320x240", "640x480", "800x600", "1024x768", "1280x720", "1366x768", "1600x900", "1920x1080");
|
||||
cb.setItems(availableres);
|
||||
// Setting default ChoiceBox value to the one already in the config file
|
||||
if (!availableres.contains(setter.getResolution())) {
|
||||
cb.setValue("640x480");
|
||||
} else {
|
||||
cb.setValue(setter.getResolution());
|
||||
}
|
||||
|
||||
/******************/
|
||||
/* Fullscreen box */
|
||||
/******************/
|
||||
|
||||
// Getting fullscreen CheckBox object from namespace
|
||||
CheckBox fs = (CheckBox) namespace.get("fullscreen");
|
||||
// Setting default CheckBox value to the one already in the config file
|
||||
if(setter.getFullscreen()) {
|
||||
fs.setSelected(true);
|
||||
} else {
|
||||
fs.setSelected(false);
|
||||
}
|
||||
|
||||
/**************/
|
||||
/* Rounds box */
|
||||
/**************/
|
||||
|
||||
// Getting rounds ChoiceBox object from namespace
|
||||
ChoiceBox<String> cbr = (ChoiceBox<String>) namespace.get("rounds");
|
||||
// Assigning list of possible choices to ChoiceBox
|
||||
ObservableList<String> nbrounds = FXCollections.observableArrayList("1", "3", "5", "7", "9");
|
||||
cbr.setItems(nbrounds);
|
||||
// Setting default ChoiceBox value to the one already in the config file
|
||||
if (!nbrounds.contains(setter.getRounds())) {
|
||||
cbr.setValue("3");
|
||||
} else {
|
||||
cbr.setValue(setter.getRounds());
|
||||
}
|
||||
|
||||
/****************/
|
||||
/* Hitboxes box */
|
||||
/****************/
|
||||
|
||||
// Getting hitboxes CheckBox from namespace
|
||||
CheckBox hb = (CheckBox) namespace.get("hitboxes");
|
||||
// Setting default CheckBox value to the one already in the config file
|
||||
if (setter.getHitboxes()) {
|
||||
hb.setSelected(true);
|
||||
} else {
|
||||
hb.setSelected(false);
|
||||
}
|
||||
|
||||
|
||||
/********************/
|
||||
/* Character select */
|
||||
/********************/
|
||||
|
||||
// Getting character 1 ChoiceBox from namespace
|
||||
VBox v1 = (VBox) namespace.get("p1");
|
||||
ChoiceBox<String> b1 = (ChoiceBox<String>) v1.getChildren().get(1);
|
||||
// Getting character 2 ChoiceBox from namespace
|
||||
VBox v2 = (VBox) namespace.get("p2");
|
||||
ChoiceBox<String> b2 = (ChoiceBox<String>) v2.getChildren().get(1);
|
||||
// Assigning list of possible choices to ChoiceBoxes
|
||||
ObservableList<String> availablechar = FXCollections.observableArrayList("Blue");
|
||||
b1.setItems(availablechar);
|
||||
b2.setItems(availablechar);
|
||||
// Setting default ChoiceBoxes values to the ones already in the config file
|
||||
if(setter.getChar1().equals("blue") || setter.getChar1().equals("default")) {
|
||||
b1.setValue("Blue");
|
||||
}
|
||||
if(setter.getChar2().equals("blue") || setter.getChar2().equals("default")) {
|
||||
b2.setValue("Blue");
|
||||
}
|
||||
|
||||
/*******************/
|
||||
/* Window settings */
|
||||
/*******************/
|
||||
|
||||
// Removing window decorations
|
||||
primaryStage.initStyle(StageStyle.UNDECORATED);
|
||||
// Setting window title
|
||||
primaryStage.setTitle("Boulevard Combattant");
|
||||
// Assinging main scene to primaryStage
|
||||
primaryStage.setScene(main);
|
||||
// Showing the stage to the user
|
||||
primaryStage.show();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* saves all settings to game.set and then launches the Engine thread
|
||||
* @author François Autin
|
||||
*/
|
||||
@FXML
|
||||
private void runGame() {
|
||||
|
||||
try {
|
||||
fillArraySettings();
|
||||
setter.setSettings();
|
||||
match.main(null);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Fill all boxes to launch the game");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* fills the array bridging between the launcher and the setter class
|
||||
* @throws NullPointerException if namespace does not contain required classes
|
||||
* @author François Autin
|
||||
*/
|
||||
private void fillArraySettings() throws NullPointerException {
|
||||
// Converting the choice of resolution to two workable variables
|
||||
int width, height;
|
||||
ChoiceBox<String> cb = (ChoiceBox<String>) namespace.get("resolution");
|
||||
switch (cb.getValue()) {
|
||||
case "320x240":
|
||||
width = 320;
|
||||
height = 240;
|
||||
break;
|
||||
case "800x600":
|
||||
width = 800;
|
||||
height = 600;
|
||||
break;
|
||||
case "1024x768":
|
||||
width = 1024;
|
||||
height = 768;
|
||||
break;
|
||||
case "1280x720":
|
||||
width = 1280;
|
||||
height = 720;
|
||||
break;
|
||||
case "1366x768":
|
||||
width = 1366;
|
||||
height = 768;
|
||||
break;
|
||||
case "1600x900":
|
||||
width = 1600;
|
||||
height = 900;
|
||||
break;
|
||||
case "1920x1080":
|
||||
width = 1920;
|
||||
height = 1080;
|
||||
break;
|
||||
default:
|
||||
width = 640;
|
||||
height = 480;
|
||||
break;
|
||||
}
|
||||
arraysettings.put("width", width);
|
||||
arraysettings.put("height", height);
|
||||
|
||||
// Fullscreen
|
||||
CheckBox fs = (CheckBox) namespace.get("fullscreen");
|
||||
arraysettings.put("fullscreen", fs.isSelected());
|
||||
|
||||
// Hitboxes
|
||||
CheckBox hb = (CheckBox) namespace.get("hitboxes");
|
||||
arraysettings.put("hitboxes", hb.isSelected());
|
||||
|
||||
// Number of rounds
|
||||
ChoiceBox<String> rnd = (ChoiceBox<String>) namespace.get("rounds");
|
||||
arraysettings.put("rounds", rnd.getValue());
|
||||
|
||||
// Character 1
|
||||
VBox vp1 = (VBox) namespace.get("p1");
|
||||
ChoiceBox<String> p1 = (ChoiceBox<String>) vp1.getChildren().get(1);
|
||||
arraysettings.put("character1", p1.getValue().toLowerCase());
|
||||
|
||||
// Character 2
|
||||
VBox vp2 = (VBox) namespace.get("p2");
|
||||
ChoiceBox<String> p2 = (ChoiceBox<String>) vp2.getChildren().get(1);
|
||||
arraysettings.put("character2", p2.getValue().toLowerCase());
|
||||
|
||||
// Stage
|
||||
arraysettings.put("stage", "default");
|
||||
}
|
||||
|
||||
/**
|
||||
* quits the launcher and the game
|
||||
*/
|
||||
@FXML
|
||||
private void quit() {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* links to the gitlab project page
|
||||
*/
|
||||
@FXML
|
||||
private void website() {
|
||||
getHostServices().showDocument("https://gitlab.istic.univ-rennes1.fr/fautin/jeu-de-combat");
|
||||
}
|
||||
|
||||
/**
|
||||
* changes the character image of the player 1 depending on its character selection
|
||||
*/
|
||||
@FXML
|
||||
private void chp1() {
|
||||
chp(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* changes the character image of the player 1 depending on its character selection
|
||||
*/
|
||||
@FXML
|
||||
private void chp2() {
|
||||
chp(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* changes the character image of the player n depending on its character selection
|
||||
*/
|
||||
@FXML
|
||||
private void chp(int n) {
|
||||
// if we try to change the character image of a player who does not exist, we simply return without doing anything
|
||||
if(n > 2 || n < 1) {
|
||||
return;
|
||||
}
|
||||
// getting the corresponding VBox
|
||||
VBox v = (VBox) namespace.get("p" + Integer.toString(n));
|
||||
// getting the first child of the VBox (the imageview containing the character image
|
||||
ImageView iv = (ImageView) v.getChildren().get(0);
|
||||
// Evaluating the new character choice in order to change the image accordingly
|
||||
ChoiceBox<String> b = (ChoiceBox<String>) v.getChildren().get(1);
|
||||
switch (b.getValue()) {
|
||||
case "Blue":
|
||||
iv.setImage(new Image("/launcher/charfaces/blue.png"));
|
||||
break;
|
||||
default:
|
||||
iv.setImage(new Image("/launcher/default.png"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hashmap containing all settings inputed in the launcher by the user
|
||||
* @return the hashmap containing all settings inputed in the launcher by the user
|
||||
*/
|
||||
protected static HashMap<String, Object> getArraysettings() {
|
||||
return arraysettings;
|
||||
}
|
||||
|
||||
}
|
246
src/main/java/launcher/Settings.java
Normal file
@ -0,0 +1,246 @@
|
||||
package launcher;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.json.simple.*;
|
||||
import org.json.simple.parser.*;
|
||||
|
||||
/**
|
||||
* <p>Allows the launcher to modify the game.set json file</p>
|
||||
* @author François Autin
|
||||
* @author Indy Boyeau
|
||||
*/
|
||||
public class Settings {
|
||||
|
||||
private int width, height, rounds;
|
||||
private boolean fullscreen, hitboxes;
|
||||
private String stage, p1, p2;
|
||||
|
||||
/**
|
||||
* <p>Settings allows manipulating the JSON game.set file.</p>
|
||||
* <p>The constructor parses the game.set file.</p>
|
||||
* @author François Autin
|
||||
*/
|
||||
public Settings() {
|
||||
try {
|
||||
parse();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Parses the game.set file (creates it if it does not exist).</p>
|
||||
* <p>Isolates the relevant settings from the game.set JSONFile and puts them in the correct global variables of the Settings class</p>
|
||||
* @throws FileNotFoundException if the game.set file does not exist
|
||||
* @throws IOException in case of IO error
|
||||
* @throws ParseException if the JSON file is invalid
|
||||
* @throws Exception for any other unaccounted for exception
|
||||
* @author François Autin
|
||||
* @author Indy Boyeau
|
||||
*/
|
||||
private void parse() throws Exception {
|
||||
|
||||
// Initializing the parser
|
||||
JSONParser jsonP = new JSONParser();
|
||||
|
||||
try {
|
||||
|
||||
// Loading the json document into memory
|
||||
JSONObject jsonO = (JSONObject) jsonP.parse(new FileReader("game.set"));
|
||||
// Getting the primary node (game)
|
||||
JSONArray root = (JSONArray) jsonO.get("game");
|
||||
JSONObject settings = (JSONObject) root.get(0);
|
||||
|
||||
// Rounds
|
||||
rounds = Integer.parseInt((String) settings.get("rounds"));
|
||||
|
||||
// Character selection
|
||||
p1 = (String) settings.get("character1");
|
||||
p2 = (String) settings.get("character2");
|
||||
|
||||
// Resolution
|
||||
height = Integer.parseInt((String) settings.get("height"));
|
||||
width = Integer.parseInt((String) settings.get("width"));
|
||||
|
||||
// Fullscreen
|
||||
String fs = (String) settings.get("fullscreen");
|
||||
if (fs.equals("true")) {
|
||||
fullscreen = true;
|
||||
} else fullscreen = false;
|
||||
|
||||
// Hitboxes
|
||||
String hb = (String) settings.get("hitboxes");
|
||||
if (hb.equals("true")) {
|
||||
hitboxes = true;
|
||||
} else hitboxes = false;
|
||||
|
||||
// Stage
|
||||
stage = (String) settings.get("stage");
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
// If the file does not exist, we create it
|
||||
File f = new File("game.set");
|
||||
try {
|
||||
f.createNewFile();
|
||||
parse();
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
} catch (ParseException e) {
|
||||
rounds = 3;
|
||||
p1 = "default";
|
||||
p2 = "default";
|
||||
width = 800;
|
||||
height = 600;
|
||||
fullscreen = false;
|
||||
hitboxes = false;
|
||||
stage = "default";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Converts user inputed data to settings passable to the write() method</p>
|
||||
* @throws Exception any exception caused by write(...)
|
||||
* @author François Autin
|
||||
*/
|
||||
protected void setSettings() throws Exception {
|
||||
|
||||
// Getting the HashMap arraysettings containing all user inputed settings
|
||||
HashMap<String, Object> arraysettings = Launcher.getArraysettings();
|
||||
|
||||
try {
|
||||
// Putting arraysettings content in global variables
|
||||
width = (Integer) arraysettings.get("width");
|
||||
height = (Integer) arraysettings.get("height");
|
||||
rounds = Integer.parseInt((String) arraysettings.get("rounds"));
|
||||
fullscreen = (Boolean) arraysettings.get("fullscreen");
|
||||
hitboxes = (Boolean) arraysettings.get("hitboxes");
|
||||
p1 = (String) arraysettings.get("character1");
|
||||
p2 = (String) arraysettings.get("character2");
|
||||
stage = (String) arraysettings.get("stage");
|
||||
// Writing to file
|
||||
write();
|
||||
} catch (Exception e) {
|
||||
// Failsafe in case of Exception
|
||||
write(800, 600, 3, false, false, "blue", "blue", "default");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>This version of the write method without parameters simply passes the global variables of the Settings class instance to the full write method.</p>
|
||||
* @throws Exception any exception caused by write(...)
|
||||
* @author François Autin
|
||||
*/
|
||||
private void write() throws Exception {
|
||||
write(width, height, rounds, fullscreen, hitboxes, p1, p2, stage);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Write echoes all user settings to the game.set JSON File</p>
|
||||
* @param width the width of the game window
|
||||
* @param height the height of the game window
|
||||
* @param rounds the number of rounds to be played
|
||||
* @param fullscreen whether or not to show the window fullscreen
|
||||
* @param hitboxes whether or not to display the hitboxes
|
||||
* @param character1 the name of the character chosen by player 1
|
||||
* @param character2 the name of the character chosen by player 2
|
||||
* @param stage the name of the stage
|
||||
* @throws FileNotFoundException if the game.set file does not exist
|
||||
* @throws IOException in case of IO error
|
||||
* @throws Exception for any other unaccounted for exception
|
||||
* @author François Autin
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private 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();
|
||||
|
||||
JSONObject set = new JSONObject();
|
||||
set.put("width", Integer.toString(width));
|
||||
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);
|
||||
|
||||
array.add(set);
|
||||
|
||||
metafile.put("game", array);
|
||||
|
||||
try (FileWriter file = new FileWriter("game.set", false)) {
|
||||
file.write(metafile.toJSONString());
|
||||
file.close();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current resolution setting
|
||||
* @return a string of the (width)x(height) format
|
||||
* @author François Autin
|
||||
*/
|
||||
public String getResolution() {
|
||||
return "" + Integer.toString(width) + "x" + Integer.toString(height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current fullscreen setting
|
||||
* @return <p>A boolean:<ul><li>true if fullscreen mode</li><li>false if windowed mode</li></ul></p>
|
||||
* @author François Autin
|
||||
*/
|
||||
public boolean getFullscreen() {
|
||||
return fullscreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current hitbox setting
|
||||
* @return <p>A boolean:<ul><li>true if hitboxes are to be showed</li><li>false if hitboxes are to be hidden</li></ul></p>
|
||||
* @author François Autin
|
||||
*/
|
||||
public boolean getHitboxes() {
|
||||
return hitboxes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current rounds setting
|
||||
* @return The number of rounds to be played
|
||||
* @author François Autin
|
||||
*/
|
||||
public String getRounds() {
|
||||
return Integer.toString(rounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current fullscreen setting
|
||||
* @return the name of the character chosen by player 1
|
||||
* @author François Autin
|
||||
*/
|
||||
public String getChar1() {
|
||||
return p1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current fullscreen setting
|
||||
* @return the name of the character chosen by player 2
|
||||
* @author François Autin
|
||||
*/
|
||||
public String getChar2() {
|
||||
return p2;
|
||||
}
|
||||
|
||||
}
|
BIN
src/main/resources/launcher/charfaces/blue.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
src/main/resources/launcher/charfaces/default.png
Normal file
After Width: | Height: | Size: 212 KiB |
102
src/main/resources/launcher/launcher.fxml
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Launcher FXML
|
||||
@author François AUTIN
|
||||
-->
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ChoiceBox?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Hyperlink?>
|
||||
|
||||
<HBox xmlns:fx="http://javafx.com/fxml" stylesheets="@style.css" fx:id="window"
|
||||
prefWidth="1280" prefHeight="720"
|
||||
fx:controller="launcher.Launcher">
|
||||
|
||||
<children>
|
||||
|
||||
<VBox fx:id="sidepanel"
|
||||
minWidth="280" prefHeight="1280">
|
||||
<children>
|
||||
|
||||
<ImageView fx:id="logo" fitHeight="120" fitWidth="120">
|
||||
<image>
|
||||
<Image url="/launcher/logo.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
|
||||
<Label StyleClass="title" text="BOULEVARD"/>
|
||||
<Label StyleClass="title" text="COMBATTANT"/>
|
||||
|
||||
<VBox fx:id="btn"
|
||||
prefWidth="120" prefHeight="260" spacing="5">
|
||||
<children>
|
||||
<Label text="Resolution"/>
|
||||
<ChoiceBox fx:id="resolution" styleClass="res_box"/>
|
||||
<HBox fx:id="fs_box" styleClass="fs_box">
|
||||
<children>
|
||||
<Label text="Fullscreen "/>
|
||||
<CheckBox fx:id="fullscreen"/>
|
||||
</children>
|
||||
</HBox>
|
||||
<Label text="Rounds"/>
|
||||
<ChoiceBox fx:id="rounds" styleClass="res_box"/>
|
||||
<HBox fx:id="hb_box" styleClass="fs_box">
|
||||
<children>
|
||||
<Label text="Hitboxes "/>
|
||||
<CheckBox fx:id="hitboxes"/>
|
||||
</children>
|
||||
</HBox>
|
||||
<Button text="Play" fx:id="btn_launch" onAction="#runGame"
|
||||
prefWidth="110" prefHeight="15"/>
|
||||
<Button text="Quit" fx:id="btn_quit" onAction="#quit"
|
||||
prefWidth="110" prefHeight="15"/>
|
||||
</children>
|
||||
</VBox>
|
||||
|
||||
<VBox fx:id="prgm"
|
||||
prefWidth="120">
|
||||
<children>
|
||||
<Hyperlink text="GIT" onAction="#website"/>
|
||||
<Text text="Ver: Snapshot"/>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</VBox>
|
||||
|
||||
<HBox fx:id="picker">
|
||||
<children>
|
||||
<VBox fx:id="p1" styleClass="pane_p" prefWidth="500" prefHeight="720">
|
||||
<children>
|
||||
<ImageView styleClass="char_img" fitHeight="400" fitWidth="400">
|
||||
<image>
|
||||
<Image url="/launcher/charfaces/default.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
<ChoiceBox styleClass="char_box" onAction="#chp1"/>
|
||||
</children>
|
||||
</VBox>
|
||||
<VBox fx:id="p2" styleClass="pane_p" prefWidth="500" prefHeight="720">
|
||||
<children>
|
||||
<ImageView styleClass="char_img" fx:id="char_p2" fitHeight="400" fitWidth="400">
|
||||
<image>
|
||||
<Image url="/launcher/charfaces/default.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
<ChoiceBox styleClass="char_box" onAction="#chp2"/>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</HBox>
|
||||
|
||||
</children>
|
||||
|
||||
</HBox>
|
BIN
src/main/resources/launcher/logo.png
Normal file
After Width: | Height: | Size: 19 KiB |
81
src/main/resources/launcher/style.css
Normal file
@ -0,0 +1,81 @@
|
||||
#window {
|
||||
-fx-background-color: #131320;
|
||||
-fx-font-size: 1.25em;
|
||||
}
|
||||
|
||||
Text, Label {
|
||||
-fx-fill: #f2f2f2;
|
||||
-fx-text-fill: #f2f2f2;
|
||||
}
|
||||
|
||||
/*************/
|
||||
/* Sidepanel */
|
||||
/*************/
|
||||
|
||||
#sidepanel {
|
||||
-fx-background-color: #303050;
|
||||
-fx-alignment: center;
|
||||
}
|
||||
|
||||
/* Logo */
|
||||
.title {
|
||||
-fx-font-weight: bold;
|
||||
-fx-font-size: 1.5em;
|
||||
-fx-padding: 1;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
#btn {
|
||||
-fx-alignment: center;
|
||||
}
|
||||
|
||||
#btn Button {
|
||||
-fx-cursor: hand;
|
||||
-fx-border-radius: 0;
|
||||
-fx-border: none;
|
||||
-fx-font-weight: bold;
|
||||
}
|
||||
|
||||
#btn_launch {
|
||||
-fx-background-color: #30c130;
|
||||
-fx-text-fill: #f2f2f2;
|
||||
}
|
||||
|
||||
#btn_quit {
|
||||
-fx-background-color: #c13030;
|
||||
-fx-text-fill: #f2f2f2;
|
||||
}
|
||||
|
||||
/* Settings */
|
||||
|
||||
ChoiceBox Label {
|
||||
-fx-fill: #000000;
|
||||
-fx-text-fill: #000000;
|
||||
}
|
||||
|
||||
.fs_box {
|
||||
-fx-alignment: center;
|
||||
}
|
||||
|
||||
/* Project details */
|
||||
#prgm {
|
||||
-fx-alignment: bottom-center;
|
||||
-fx-padding: 5;
|
||||
}
|
||||
|
||||
/* Link to project */
|
||||
Hyperlink:visited {
|
||||
-fx-text-fill: #0095c8;
|
||||
}
|
||||
|
||||
/**********/
|
||||
/* Picker */
|
||||
/**********/
|
||||
|
||||
#picker {
|
||||
-fx-alignment: top-center;
|
||||
}
|
||||
|
||||
#picker VBox {
|
||||
-fx-alignment: top-center;
|
||||
}
|
10
src/main/resources/shaders/ObjectGl/frag.glsl
Normal file
@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform float time;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = vec4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
12
src/main/resources/shaders/ObjectGl/vert.glsl
Normal file
@ -0,0 +1,12 @@
|
||||
#version 330 core
|
||||
|
||||
layout (location = 0) in vec3 aPos;
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 view;
|
||||
uniform mat4 transform;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection * view * transform * vec4(aPos, 1.0);
|
||||
}
|
12
src/main/resources/shaders/ObjectGlColor/frag.glsl
Normal file
@ -0,0 +1,12 @@
|
||||
#version 330 core
|
||||
|
||||
in vec3 color;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform float time;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = vec4(color, 1.0f);
|
||||
}
|
16
src/main/resources/shaders/ObjectGlColor/vert.glsl
Normal file
@ -0,0 +1,16 @@
|
||||
#version 330 core
|
||||
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 1) in vec3 aColor;
|
||||
|
||||
out vec3 color;
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 view;
|
||||
uniform mat4 transform;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection * view * transform * vec4(aPos, 1.0);
|
||||
color = aColor;
|
||||
}
|
13
src/main/resources/shaders/ObjectGlTex/frag.glsl
Normal file
@ -0,0 +1,13 @@
|
||||
#version 410 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
uniform sampler2D texture1;
|
||||
uniform float time;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = texture(texture1, texCoord);
|
||||
}
|
16
src/main/resources/shaders/ObjectGlTex/vert.glsl
Normal file
@ -0,0 +1,16 @@
|
||||
#version 410 core
|
||||
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 view;
|
||||
uniform mat4 transform;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection * view * transform * vec4(aPos, 1.0);
|
||||
texCoord = aTexCoord;
|
||||
}
|
19
src/main/resources/shaders/ObjectGlTexColor/frag.glsl
Normal file
@ -0,0 +1,19 @@
|
||||
#version 410 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec4 color;
|
||||
in vec2 texCoord;
|
||||
|
||||
uniform sampler2D texture1;
|
||||
uniform float time;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 tex = texture(texture1, texCoord);
|
||||
if (tex.a == 0.0){
|
||||
FragColor = tex;
|
||||
} else{
|
||||
FragColor = mix(tex, color, 0.5);
|
||||
}
|
||||
}
|
19
src/main/resources/shaders/ObjectGlTexColor/vert.glsl
Normal file
@ -0,0 +1,19 @@
|
||||
#version 410 core
|
||||
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 1) in vec3 aColor;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec4 color;
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 view;
|
||||
uniform mat4 transform;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection * view * transform * vec4(aPos, 1.0);
|
||||
color = vec4(aColor, 1.0f);
|
||||
texCoord = aTexCoord;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
#version 410 core
|
||||
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 1) in vec3 aColor;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
|
||||
out vec2 fragCoord;
|
||||
out vec4 color;
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 view;
|
||||
uniform mat4 transform;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection * view * transform * vec4(aPos, 1.0);
|
||||
color = vec4(aColor, 1.0f);
|
||||
fragCoord = aPos.xy;
|
||||
}
|
21
src/main/resources/shaders/StylishShaders/BasicVert.glsl
Normal file
@ -0,0 +1,21 @@
|
||||
#version 410 core
|
||||
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 1) in vec3 aColor;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
|
||||
out vec2 fragCoord;
|
||||
out vec2 texCoord;
|
||||
out vec4 color;
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 view;
|
||||
uniform mat4 transform;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projection * view * transform * vec4(aPos, 1.0);
|
||||
color = vec4(aColor, 1.0f);
|
||||
texCoord = aTexCoord;
|
||||
fragCoord = aPos.xy;
|
||||
}
|
26
src/main/resources/shaders/StylishShaders/FlashFrag.glsl
Normal file
@ -0,0 +1,26 @@
|
||||
#version 410 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec4 color;
|
||||
in vec2 fragCoord;
|
||||
in vec2 texCoord;
|
||||
|
||||
uniform sampler2D texture1;
|
||||
uniform float time;
|
||||
|
||||
void main(){
|
||||
|
||||
vec4 flash;
|
||||
|
||||
flash = sin(flash + time * 15);
|
||||
flash = mix(flash, color, 0.5f);
|
||||
flash.a = 1f;
|
||||
|
||||
vec4 tex = texture(texture1, texCoord);
|
||||
if (tex.a == 0.0 || (flash.x+ flash.y + flash.z)/3 <= (tex.x+ tex.y + tex.z)/3){
|
||||
FragColor = tex;
|
||||
} else{
|
||||
FragColor = mix(tex, flash, 0.3f);
|
||||
}
|
||||
}
|
13
src/main/resources/shaders/StylishShaders/HitboxFrag.glsl
Normal file
@ -0,0 +1,13 @@
|
||||
#version 410
|
||||
|
||||
in vec3 color;
|
||||
in vec3 fragCoord;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform float time;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = vec4(color, 0.4f);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
#version 410
|
||||
|
||||
in vec4 color;
|
||||
in vec2 fragCoord;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform float time;
|
||||
uniform float fill;
|
||||
uniform bool leftToRight;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (leftToRight){
|
||||
if (fill > fragCoord.x){
|
||||
FragColor = color;
|
||||
}
|
||||
else {
|
||||
FragColor = vec4(color.xyz, 0f);
|
||||
}
|
||||
} else {
|
||||
if (fill < fragCoord.x){
|
||||
FragColor = color;
|
||||
}
|
||||
else {
|
||||
FragColor = vec4(color.xyz, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
#version 410
|
||||
|
||||
in vec4 color;
|
||||
in vec2 fragCoord;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform float time;
|
||||
uniform float fill;
|
||||
uniform bool leftToRight;
|
||||
uniform float height;
|
||||
|
||||
void main()
|
||||
{ //Rectangle plus large que haut
|
||||
vec4 colorTemp = color;
|
||||
float ouverture = 0.8f;
|
||||
// Effet "tube"
|
||||
float lum = -pow(fragCoord.y + height/2.0f, 2.0f) * 5.0f /height + ouverture;
|
||||
colorTemp.xyz *= lum;
|
||||
|
||||
// Effet flash sur la surface
|
||||
float flash = abs(sin(time)) + 0.4f;
|
||||
colorTemp.xyz *= flash;
|
||||
|
||||
if (leftToRight){
|
||||
if (fill > fragCoord.x){
|
||||
FragColor = colorTemp;
|
||||
}
|
||||
else {
|
||||
FragColor = vec4(0.0f);
|
||||
}
|
||||
} else {
|
||||
if (fill < fragCoord.x){
|
||||
FragColor = colorTemp;
|
||||
}
|
||||
else {
|
||||
FragColor = vec4(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
16
src/main/resources/shaders/StylishShaders/TextFrag.glsl
Normal file
@ -0,0 +1,16 @@
|
||||
#version 410 core
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec4 color;
|
||||
in vec2 fragCoord;
|
||||
in vec2 texCoord;
|
||||
|
||||
uniform sampler2D texture1;
|
||||
|
||||
void main(){
|
||||
vec3 black = vec3(0.0f, 0.0f , 0.0f);
|
||||
vec4 tex = texture(texture1, texCoord);
|
||||
tex.a = (tex.x + tex.y + tex.z) / 3.0f;
|
||||
FragColor = tex;
|
||||
}
|
27
src/main/resources/shaders/StylishShaders/WavyTextVert.glsl
Normal file
@ -0,0 +1,27 @@
|
||||
#version 410 core
|
||||
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 1) in vec3 aColor;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
|
||||
out vec2 fragCoord;
|
||||
out vec2 texCoord;
|
||||
out vec4 color;
|
||||
|
||||
uniform mat4 projection;
|
||||
uniform mat4 view;
|
||||
uniform mat4 transform;
|
||||
uniform int index;
|
||||
uniform float time;
|
||||
|
||||
void main()
|
||||
{
|
||||
float speed = 5f;
|
||||
float amplitude = 10f;
|
||||
vec3 newPos = aPos;
|
||||
newPos.y = newPos.y + (sin((time + index * 10f + newPos.x) * speed) * amplitude);
|
||||
gl_Position = projection * view * transform * vec4(newPos, 1.0);
|
||||
color = vec4(aColor, 1.0f);
|
||||
texCoord = aTexCoord;
|
||||
fragCoord = aPos.xy;
|
||||
}
|
BIN
src/main/resources/sound/jump.ogg
Normal file
BIN
src/main/resources/textures/Sprite_9comp.png
Normal file
After Width: | Height: | Size: 577 KiB |
BIN
src/main/resources/textures/Sprite_sans_grille_9comp.png
Normal file
After Width: | Height: | Size: 597 KiB |
BIN
src/main/resources/textures/arena1.png
Normal file
After Width: | Height: | Size: 313 KiB |
BIN
src/main/resources/textures/awesomeface.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
src/main/resources/textures/background_beach.png
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
src/main/resources/textures/container.jpg
Normal file
After Width: | Height: | Size: 181 KiB |
BIN
src/main/resources/textures/dejavu10x10_gs_tc.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
src/main/resources/textures/health_bar.png
Normal file
After Width: | Height: | Size: 560 KiB |
BIN
src/main/resources/textures/health_bar_9compress.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 7.6 KiB |
147
src/main/resources/textures/keyboard_pad_glyphs/Readme.txt
Normal file
@ -0,0 +1,147 @@
|
||||
Hey there!
|
||||
|
||||
Hope you make good use of this pack. You can use all these assets in any project you want to (be it commercial or not).All of the assets are in the public domain under Creative Commons 0 (CC0)
|
||||
|
||||
In this pack you will find over 500 buttons including:
|
||||
|
||||
Xbox 360 Controller
|
||||
Xbox One Controller + Diagram
|
||||
Xbox Series X Controller + Diagram
|
||||
Play Station 3 Controller
|
||||
Play Station 4 Controller + Diagram
|
||||
Play Station 5 Controller + Diagram
|
||||
Play Station Move
|
||||
PS Vita
|
||||
Google Stadia Controller
|
||||
Amazon Luna Controller
|
||||
Vive Controller
|
||||
Oculus Controllers & Remote
|
||||
Wii Controller
|
||||
Wii U Controller
|
||||
Nintentdo Switch
|
||||
Steam Controller (Updated to commercial version)
|
||||
Ouya
|
||||
Keyboard and mouse buttons (Both in dark and light variants including blanks)
|
||||
Directional arrows for thumb sticks and movement keys
|
||||
Touch Screen Gestures
|
||||
|
||||
----------------------------------
|
||||
|
||||
I am "Nicolae (Xelu) Berbece", I'm responsible for the development studio "Those Awesome Guys", developers of "Move or Die" and publishers of "Monster Prom".
|
||||
|
||||
You can contact me at nick@thoseawesomeguys.com or @xelubest
|
||||
|
||||
Feel free to credit me in case you use anything in this pack, but don't worry, I won't mind if you don't. ;)
|
||||
|
||||
Please share this pack with other fellow developers in need of such assets! In the spirit of good old chain mail, if you share this pack with 5 fellow devs, your game's steam review score will rise by 7% and a notable twitch streamer will pick it up for their stream.
|
||||
|
||||
Keep making awesome things!!!
|
||||
|
||||
~Nick
|
||||
|
||||
|
||||
|
||||
Here is a semi-regularly-updated list of games using these prompts:
|
||||
----------------------------
|
||||
Mega Man Legacy
|
||||
Hunt: Showdown
|
||||
Outter Wilds
|
||||
Slay The Spire
|
||||
A hat in Time
|
||||
Forager
|
||||
Wonder Boy the dragon's trap
|
||||
Postal 2
|
||||
Postal Redux
|
||||
RWBY
|
||||
PikuNiku
|
||||
Shadow Warrior 2
|
||||
Tiny Metal
|
||||
Aztez
|
||||
Disney Afternoon
|
||||
Heat Signature
|
||||
Turbo Dismount
|
||||
Black Future 88
|
||||
Fallen Legion
|
||||
Fru
|
||||
Blockships
|
||||
20XX
|
||||
Furi
|
||||
Mike Dies
|
||||
Snake Pass
|
||||
Danger Scavenger
|
||||
Roboquest
|
||||
Rive
|
||||
Faerie Afterlight
|
||||
Obduction
|
||||
Fractal Fall
|
||||
Guild of Ascension
|
||||
Avaria VS
|
||||
Blast Zone! Tournament
|
||||
100ft Robot Golf
|
||||
Sockventure
|
||||
Spellbreak
|
||||
Zombie Rollerz
|
||||
B.O.O.M . - You Win
|
||||
Battle Chef Brigade
|
||||
De Blob
|
||||
Phantom Brigade
|
||||
Wytchwood
|
||||
Mulaka
|
||||
Airheart - Tales of broken wings
|
||||
Redirection
|
||||
Pull Stay
|
||||
Death Pedal
|
||||
Defender's Quest
|
||||
Akuto "Mad World"
|
||||
Project Mobius
|
||||
Whispering Willows
|
||||
Vostok Inc.
|
||||
Divine commander
|
||||
Sbirz
|
||||
Grashers
|
||||
Remnants of Naezith
|
||||
Mothergunship
|
||||
Roundabout
|
||||
Hunter of the Disowned
|
||||
Cosmos Quickstop
|
||||
West of Dead
|
||||
Tune Tank
|
||||
Rain on your Parade
|
||||
Infinite Adventures
|
||||
Arena 3D
|
||||
Chroma Vaders
|
||||
Hoverloop
|
||||
Wrestling Revolution 3D
|
||||
Altero
|
||||
Super Comboman
|
||||
Disc Jam
|
||||
Cooking Simulator
|
||||
Jelly is Sticky
|
||||
The Hatching
|
||||
World to the West
|
||||
Mayan Death Robots
|
||||
Sentris
|
||||
Carto
|
||||
Unbox
|
||||
Fort Triumph
|
||||
Insane Robots
|
||||
Super Daryl Deluxe
|
||||
Induction
|
||||
Pawarumi
|
||||
The Flock
|
||||
Binary Trigger
|
||||
Fractal Space
|
||||
Deputy dangle
|
||||
Bubsy: The Woolies Strike Back
|
||||
Tumblestone
|
||||
The chronicles of Kyra
|
||||
Ghost Knight Victis
|
||||
Solbrain Knight of Darkness
|
||||
SSMP
|
||||
Distance
|
||||
Idarb
|
||||
Earthlock
|
||||
Everspace
|
||||
Pylon Rogue
|
||||
The Church in the darkness
|
||||
Sword n' Board
|
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 3.7 KiB |
BIN
src/main/resources/textures/shadow.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
45
src/main/resources/textures/sprite_action.txt
Normal file
@ -0,0 +1,45 @@
|
||||
1-idle
|
||||
2-walking
|
||||
3-jump
|
||||
4-crouch
|
||||
5-blocking
|
||||
6-L_punch
|
||||
7-forward jump
|
||||
8-m/h punch
|
||||
9-forward h punch
|
||||
10-h kick
|
||||
11-forward h kick
|
||||
12-jump l m kick
|
||||
13-crouch L.punch
|
||||
14-crouch m punch
|
||||
15-crouch h punch
|
||||
16-jump h kick
|
||||
17-crouch hit
|
||||
18-fjl punch
|
||||
19-hadouken
|
||||
20-projectile
|
||||
21-hit
|
||||
22-jump l m h puch
|
||||
23-face hit
|
||||
24-ko
|
||||
25-lm kick
|
||||
26-forward m punch
|
||||
27-forward l kick
|
||||
28-crouch L kick
|
||||
29-shouryuken
|
||||
30-forward m kick
|
||||
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:
|
||||
time over (40)
|
||||
alternate palettes(41)
|
BIN
src/main/resources/textures/zangief_sprite.png
Normal file
After Width: | Height: | Size: 27 KiB |