diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..c10a6f7 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..b26911b --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_joml_joml_1_9_24.xml b/.idea/libraries/Maven__org_joml_joml_1_9_24.xml new file mode 100644 index 0000000..6f5840d --- /dev/null +++ b/.idea/libraries/Maven__org_joml_joml_1_9_24.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_3_2_3.xml new file mode 100644 index 0000000..d151ac8 --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_assimp_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_assimp_3_2_3.xml new file mode 100644 index 0000000..64acbdf --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_assimp_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_assimp_natives_windows_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_assimp_natives_windows_3_2_3.xml new file mode 100644 index 0000000..a4e7d4f --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_assimp_natives_windows_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_glfw_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_glfw_3_2_3.xml new file mode 100644 index 0000000..a0c9717 --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_glfw_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_glfw_natives_windows_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_glfw_natives_windows_3_2_3.xml new file mode 100644 index 0000000..3b5ec8f --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_glfw_natives_windows_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_natives_windows_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_natives_windows_3_2_3.xml new file mode 100644 index 0000000..8c47f48 --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_natives_windows_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_openal_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_openal_3_2_3.xml new file mode 100644 index 0000000..16cafc0 --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_openal_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_openal_natives_windows_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_openal_natives_windows_3_2_3.xml new file mode 100644 index 0000000..567dc3a --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_openal_natives_windows_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_opengl_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_opengl_3_2_3.xml new file mode 100644 index 0000000..c07061e --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_opengl_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_opengl_natives_windows_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_opengl_natives_windows_3_2_3.xml new file mode 100644 index 0000000..4cd60f7 --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_opengl_natives_windows_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_stb_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_stb_3_2_3.xml new file mode 100644 index 0000000..679c690 --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_stb_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_lwjgl_lwjgl_stb_natives_windows_3_2_3.xml b/.idea/libraries/Maven__org_lwjgl_lwjgl_stb_natives_windows_3_2_3.xml new file mode 100644 index 0000000..7ede507 --- /dev/null +++ b/.idea/libraries/Maven__org_lwjgl_lwjgl_stb_natives_windows_3_2_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..71bba8c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..06a4dda --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/jumpGame.iml b/jumpGame.iml new file mode 100644 index 0000000..13770d9 --- /dev/null +++ b/jumpGame.iml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e461d95 --- /dev/null +++ b/pom.xml @@ -0,0 +1,105 @@ + + + 4.0.0 + + jumpGame + jumpGame + 1.0-SNAPSHOT + + + 3.2.3 + 1.9.24 + natives-windows + UTF-8 + 1.8 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 11.0 + 11.0 + + + + + + + + + org.lwjgl + lwjgl-bom + ${lwjgl.version} + import + pom + + + + + + + org.lwjgl + lwjgl + + + org.lwjgl + lwjgl-assimp + + + org.lwjgl + lwjgl-glfw + + + org.lwjgl + lwjgl-openal + + + org.lwjgl + lwjgl-opengl + + + org.lwjgl + lwjgl-stb + + + org.lwjgl + lwjgl + ${lwjgl.natives} + + + org.lwjgl + lwjgl-assimp + ${lwjgl.natives} + + + org.lwjgl + lwjgl-glfw + ${lwjgl.natives} + + + org.lwjgl + lwjgl-openal + ${lwjgl.natives} + + + org.lwjgl + lwjgl-opengl + ${lwjgl.natives} + + + org.lwjgl + lwjgl-stb + ${lwjgl.natives} + + + org.joml + joml + ${joml.version} + + + \ No newline at end of file diff --git a/src/main/java/Main.java b/src/main/java/Main.java new file mode 100644 index 0000000..c6d48d4 --- /dev/null +++ b/src/main/java/Main.java @@ -0,0 +1,110 @@ +import org.lwjgl.glfw.*; +import org.lwjgl.opengl.*; + +import org.lwjgl.Version; +import static org.lwjgl.glfw.Callbacks.*; + +import static org.lwjgl.glfw.GLFW.*; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.system.MemoryUtil.*; + +public class Main { + + // The window handle + private long window; + + public void run() { + System.out.println("Hello LWJGL " + Version.getVersion() + "!"); + + try { + init(); + loop(); + + // Release window and window callbacks + glfwFreeCallbacks(window); + glfwDestroyWindow(window); + } finally { + // Terminate GLFW and release the GLFWerrorfun + glfwTerminate(); + glfwSetErrorCallback(null).free(); + } + } + + private void init() { + // Setup an error callback. The default implementation + // will print the error message in System.err. + GLFWErrorCallback.createPrint(System.err).set(); + + // Initialize GLFW. Most GLFW functions will not work before doing this. + if (!glfwInit()) { + throw new IllegalStateException("Unable to initialize GLFW"); + } + + // Configure our window + glfwDefaultWindowHints(); // optional, the current window hints are already the default + glfwWindowHint(GLFW_VISIBLE, GL_FALSE); // the window will stay hidden after creation + glfwWindowHint(GLFW_RESIZABLE, GL_TRUE); // the window will be resizable + + int WIDTH = 300; + int HEIGHT = 300; + + // Create the window + window = glfwCreateWindow(WIDTH, HEIGHT, "Hello World!", NULL, NULL); + if (window == NULL) { + throw new RuntimeException("Failed to create the GLFW window"); + } + + // Setup a key callback. It will be called every time a key is pressed, repeated or released. + glfwSetKeyCallback(window, (window, key, scancode, action, mods) -> { + if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE) { + glfwSetWindowShouldClose(window, true); // We will detect this in the rendering loop + } + }); + + // Get the resolution of the primary monitor + GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); + // Center our window + glfwSetWindowPos( + window, + (vidmode.width() - WIDTH) / 2, + (vidmode.height() - HEIGHT) / 2 + ); + + // Make the OpenGL context current + glfwMakeContextCurrent(window); + // Enable v-sync + glfwSwapInterval(1); + + // Make the window visible + glfwShowWindow(window); + } + + private void loop() { + // This line is critical for LWJGL's interoperation with GLFW's + // OpenGL context, or any context that is managed externally. + // LWJGL detects the context that is current in the current thread, + // creates the ContextCapabilities instance and makes the OpenGL + // bindings available for use. + GL.createCapabilities(); + + // Set the clear color + glClearColor(1.0f, 0.0f, 0.0f, 0.0f); + + // Run the rendering loop until the user has attempted to close + // the window or has pressed the ESCAPE key. + while (!glfwWindowShouldClose(window)) { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the framebuffer + + glfwSwapBuffers(window); // swap the color buffers + + // Poll for window events. The key callback above will only be + // invoked during this call. + glfwPollEvents(); + } + } + + public static void main(String[] args) { + new Main().run(); + } + +} \ No newline at end of file diff --git a/src/main/java/resources/Acceleration.java b/src/main/java/resources/Acceleration.java new file mode 100644 index 0000000..69f1a18 --- /dev/null +++ b/src/main/java/resources/Acceleration.java @@ -0,0 +1,42 @@ +package resources; + +public class Acceleration { + private double massValue; + private Pair forceValue; + private Velocity velocity; + private Onground onground; + private Pair value; + + public void updateByMass(double mass) { + this.massValue = mass; + Pair temp_l0; + if (this.onground.getOnground()) { + temp_l0 = new Pair((forceValue.getFirst() / mass), 0.0); + } else { + temp_l0 = new Pair((forceValue.getFirst() / mass), (forceValue.getSecond() / mass)); + } + value = temp_l0; + velocity.updateByAcceleration(value); + } + + public void updateByForce(Pair force) { + this.forceValue = force; + Pair temp_l1; + if (this.onground.getOnground()) { + temp_l1 = new Pair((force.getFirst() / massValue), 0.0); + } else { + temp_l1 = new Pair((force.getFirst() / massValue), (force.getSecond() / massValue)); + } + value = temp_l1; + velocity.updateByAcceleration(value); + } + + public Acceleration(Velocity velocity, Onground onground) { + this.velocity = velocity; + this.onground = onground; + } + + public Pair getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/resources/Clear.java b/src/main/java/resources/Clear.java new file mode 100644 index 0000000..da506e7 --- /dev/null +++ b/src/main/java/resources/Clear.java @@ -0,0 +1,19 @@ +package resources; + +public class Clear { + private Position position; + + public Clear(Position position) { + this.position = position; + } + + public boolean getClear() { + boolean temp_l4; + if (((Double)this.position.getValue().getFirst() > 100.0)) { + temp_l4 = true; + } else { + temp_l4 = false; + } + return temp_l4; + } +} \ No newline at end of file diff --git a/src/main/java/resources/Force.java b/src/main/java/resources/Force.java new file mode 100644 index 0000000..b660c67 --- /dev/null +++ b/src/main/java/resources/Force.java @@ -0,0 +1,19 @@ +package resources; + +public class Force { + private Acceleration acceleration; + private Pair value; + + public Force(Acceleration acceleration) { + this.acceleration = acceleration; + } + + public void gravity(double y) { + this.value = new Pair(0.0, y); + acceleration.updateByForce(value); + } + + public Pair getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/resources/Gameover.java b/src/main/java/resources/Gameover.java new file mode 100644 index 0000000..4d3bdba --- /dev/null +++ b/src/main/java/resources/Gameover.java @@ -0,0 +1,19 @@ +package resources; + +public class Gameover { + private Position position; + + public Gameover(Position position) { + this.position = position; + } + + public boolean getGameover() { + boolean temp_l6; + if (((Double)this.position.getValue().getSecond() < -(1.0))) { + temp_l6 = true; + } else { + temp_l6 = false; + } + return temp_l6; + } +} \ No newline at end of file diff --git a/src/main/java/resources/Ground.java b/src/main/java/resources/Ground.java new file mode 100644 index 0000000..2df0f2f --- /dev/null +++ b/src/main/java/resources/Ground.java @@ -0,0 +1,9 @@ +package resources; + +public class Ground { + private boolean value; + + public boolean getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/resources/JumpGame.java b/src/main/java/resources/JumpGame.java new file mode 100644 index 0000000..c655bb4 --- /dev/null +++ b/src/main/java/resources/JumpGame.java @@ -0,0 +1,76 @@ +package resources; + +public class JumpGame { + private Time time = new Time(); + private Ground ground = new Ground(); + private Position position = new Position(ground); + private Gameover gameover = new Gameover(position); + private Onground onground = new Onground(ground, position); + private Velocity velocity = new Velocity(position, onground); + private Clear clear = new Clear(position); + private Move move = new Move(velocity); + private Acceleration acceleration = new Acceleration(velocity, onground); + private Force force = new Force(acceleration); + private Mass mass = new Mass(acceleration); + + public void gravity(double y) { + this.force.gravity(y); + this.time.gravity(y); + } + + public void moveX(double x) { + this.move.moveX(x); + } + + public void moveY(double y) { + this.move.moveY(y); + } + + public void setMass(double x) { + this.mass.setValue(x); + } + + public Pair getAcceleration() { + return acceleration.getValue(); + } + + public Pair getMove() { + return move.getValue(); + } + + public double getMass() { + return mass.getValue(); + } + + public boolean getClear() { + return clear.getClear(); + } + + public boolean getGround() { + return ground.getValue(); + } + + public Pair getForce() { + return force.getValue(); + } + + public Pair getVelocity() { + return velocity.getValue(); + } + + public Pair getPosition() { + return position.getValue(); + } + + public boolean getOnground() { + return onground.getOnground(); + } + + public double getTime() { + return time.getValue(); + } + + public boolean getGameover() { + return gameover.getGameover(); + } +} \ No newline at end of file diff --git a/src/main/java/resources/Mass.java b/src/main/java/resources/Mass.java new file mode 100644 index 0000000..c0acc82 --- /dev/null +++ b/src/main/java/resources/Mass.java @@ -0,0 +1,19 @@ +package resources; + +public class Mass { + private Acceleration acceleration; + private double value; + + public Mass(Acceleration acceleration) { + this.acceleration = acceleration; + } + + public void setValue(double x) { + this.value = x; + acceleration.updateByMass(value); + } + + public double getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/resources/Move.java b/src/main/java/resources/Move.java new file mode 100644 index 0000000..44f0d3f --- /dev/null +++ b/src/main/java/resources/Move.java @@ -0,0 +1,23 @@ +package resources; + +public class Move { + private Velocity velocity; + private Pair value; + + public Move(Velocity velocity) { + this.velocity = velocity; + } + + public void moveX(double x) { + this.value = new Pair(x, this.value.getSecond()); + velocity.updateByMove(value); + } + + public void moveY(double y) { + this.value = new Pair(this.value.getFirst(), y); + } + + public Pair getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/resources/Onground.java b/src/main/java/resources/Onground.java new file mode 100644 index 0000000..3b5fa82 --- /dev/null +++ b/src/main/java/resources/Onground.java @@ -0,0 +1,14 @@ +package resources; + +public class Onground { + private Ground ground; + private Position position; + + public Onground(Ground ground, Position position) { + this.ground = ground; + this.position = position; + } + + public boolean getOnground() { + return ((this.ground.getValue() == true) && ((Double)this.position.getValue().getSecond() <= 0.0)); } +} \ No newline at end of file diff --git a/src/main/java/resources/Pair.java b/src/main/java/resources/Pair.java new file mode 100644 index 0000000..29d3dbe --- /dev/null +++ b/src/main/java/resources/Pair.java @@ -0,0 +1,19 @@ +package resources; + +public class Pair { + private T first; + private T second; + + public Pair(T first, T second) { + this.first = first; + this.second = second; + } + + public T getFirst() { + return this.first; + } + + public T getSecond() { + return this.second; + } +} diff --git a/src/main/java/resources/Position.java b/src/main/java/resources/Position.java new file mode 100644 index 0000000..9d59e22 --- /dev/null +++ b/src/main/java/resources/Position.java @@ -0,0 +1,24 @@ +package resources; + +public class Position { + private Ground ground; + private Pair value; + + public void updateByVelocity(Pair velocity) { + Pair temp_l3; + if (((this.ground.getValue() == true) && ((this.value.getSecond() + (0.01 * velocity.getSecond())) < 0.0))) { + temp_l3 = new Pair((this.value.getFirst() + (0.01 * velocity.getFirst())), 0.0); + } else { + temp_l3 = new Pair((this.value.getFirst() + (0.01 * velocity.getFirst())), (this.value.getSecond() + (0.01 * velocity.getSecond()))); + } + value = temp_l3; + } + + public Position(Ground ground) { + this.ground = ground; + } + + public Pair getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/resources/Time.java b/src/main/java/resources/Time.java new file mode 100644 index 0000000..3ba6de2 --- /dev/null +++ b/src/main/java/resources/Time.java @@ -0,0 +1,13 @@ +package resources; + +public class Time { + private double value; + + public void gravity(double y) { + this.value = (this.value + 0.01); + } + + public double getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/main/java/resources/Velocity.java b/src/main/java/resources/Velocity.java new file mode 100644 index 0000000..ec95413 --- /dev/null +++ b/src/main/java/resources/Velocity.java @@ -0,0 +1,44 @@ +package resources; + +import com.sun.org.apache.xerces.internal.dom.DOMOutputImpl; + +public class Velocity { + private Pair moveValue; + private Pair accelerationValue; + private Position position; + private Onground onground; + private Pair value; + + public void updateByMove(Pair move) { + this.moveValue = move; + Pair temp_l2; + if ((this.onground.getOnground() && (move.getSecond() >= 0.0))) { + temp_l2 = move; + } else { + temp_l2 = this.value; + } + value = temp_l2; + position.updateByVelocity(value); + } + + public void updateByAcceleration(Pair acceleration) { + this.accelerationValue = acceleration; + Pair temp_l5; + if ((this.onground.getOnground() && (this.value.getSecond() < 0.0))) { + temp_l5 = new Pair((this.value.getFirst() + (0.01 * acceleration.getFirst())), 0.0); + } else { + temp_l5 = new Pair((this.value.getFirst() + (0.01 * acceleration.getFirst())), (this.value.getSecond() + (0.01 * acceleration.getSecond()))); + } + value = temp_l5; + position.updateByVelocity(value); + } + + public Velocity(Position position, Onground onground) { + this.position = position; + this.onground = onground; + } + + public Pair getValue() { + return value; + } +} \ No newline at end of file diff --git a/src/resources/Acceleration.java b/src/resources/Acceleration.java deleted file mode 100644 index f7d33d4..0000000 --- a/src/resources/Acceleration.java +++ /dev/null @@ -1,42 +0,0 @@ -package resources; - -public class Acceleration { - private double massValue; - private Vector2 forceValue; - private Velocity velocity; - private Onground onground; - private Vector2 value; - - public void updateByMass(double mass) { - this.massValue = mass; - Vector2 temp_l0; - if (this.onground.getOnground()) { - temp_l0 = new Vector2((forceValue.getX() / mass), 0.0); - } else { - temp_l0 = new Vector2((forceValue.getX() / mass), (forceValue.getY() / mass)); - } - value = temp_l0; - velocity.updateByAcceleration(value); - } - - public void updateByForce(Vector2 force) { - this.forceValue = force; - Vector2 temp_l1; - if (this.onground.getOnground()) { - temp_l1 = new Vector2((force.getX() / massValue), 0.0); - } else { - temp_l1 = new Vector2((force.getX() / massValue), (force.getY() / massValue)); - } - value = temp_l1; - velocity.updateByAcceleration(value); - } - - public Acceleration(Velocity velocity, Onground onground) { - this.velocity = velocity; - this.onground = onground; - } - - public Vector2 getValue() { - return value; - } -} \ No newline at end of file diff --git a/src/resources/Clear.java b/src/resources/Clear.java deleted file mode 100644 index 8076814..0000000 --- a/src/resources/Clear.java +++ /dev/null @@ -1,19 +0,0 @@ -package resources; - -public class Clear { - private Position position; - - public Clear(Position position) { - this.position = position; - } - - public boolean getClear() { - boolean temp_l4; - if ((this.position.getValue().getX() > 100.0)) { - temp_l4 = true; - } else { - temp_l4 = false; - } - return temp_l4; - } -} \ No newline at end of file diff --git a/src/resources/Force.java b/src/resources/Force.java deleted file mode 100644 index 5ee523e..0000000 --- a/src/resources/Force.java +++ /dev/null @@ -1,19 +0,0 @@ -package resources; - -public class Force { - private Acceleration acceleration; - private Vector2 value; - - public Force(Acceleration acceleration) { - this.acceleration = acceleration; - } - - public void gravity(double y) { - this.value = new Vector2(0.0, y); - acceleration.updateByForce(value); - } - - public Vector2 getValue() { - return value; - } -} \ No newline at end of file diff --git a/src/resources/Gameover.java b/src/resources/Gameover.java deleted file mode 100644 index 9f95b01..0000000 --- a/src/resources/Gameover.java +++ /dev/null @@ -1,19 +0,0 @@ -package resources; - -public class Gameover { - private Position position; - - public Gameover(Position position) { - this.position = position; - } - - public boolean getGameover() { - boolean temp_l6; - if ((this.position.getValue().getY() < -(1.0))) { - temp_l6 = true; - } else { - temp_l6 = false; - } - return temp_l6; - } -} \ No newline at end of file diff --git a/src/resources/Ground.java b/src/resources/Ground.java deleted file mode 100644 index 2df0f2f..0000000 --- a/src/resources/Ground.java +++ /dev/null @@ -1,9 +0,0 @@ -package resources; - -public class Ground { - private boolean value; - - public boolean getValue() { - return value; - } -} \ No newline at end of file diff --git a/src/resources/JumpGame.java b/src/resources/JumpGame.java deleted file mode 100644 index 6689e0e..0000000 --- a/src/resources/JumpGame.java +++ /dev/null @@ -1,76 +0,0 @@ -package resources; - -public class JumpGame { - private Time time = new Time(); - private Ground ground = new Ground(); - private Position position = new Position(ground); - private Gameover gameover = new Gameover(position); - private Onground onground = new Onground(ground, position); - private Velocity velocity = new Velocity(position, onground); - private Clear clear = new Clear(position); - private Move move = new Move(velocity); - private Acceleration acceleration = new Acceleration(velocity, onground); - private Force force = new Force(acceleration); - private Mass mass = new Mass(acceleration); - - public void gravity(double y) { - this.force.gravity(y); - this.time.gravity(y); - } - - public void moveX(double x) { - this.move.moveX(x); - } - - public void moveY(double y) { - this.move.moveY(y); - } - - public void setMass(double x) { - this.mass.setValue(x); - } - - public Vector2 getAcceleration() { - return acceleration.getValue(); - } - - public Vector2 getMove() { - return move.getValue(); - } - - public double getMass() { - return mass.getValue(); - } - - public boolean getClear() { - return clear.getClear(); - } - - public boolean getGround() { - return ground.getValue(); - } - - public Vector2 getForce() { - return force.getValue(); - } - - public Vector2 getVelocity() { - return velocity.getValue(); - } - - public Vector2 getPosition() { - return position.getValue(); - } - - public boolean getOnground() { - return onground.getOnground(); - } - - public double getTime() { - return time.getValue(); - } - - public boolean getGameover() { - return gameover.getGameover(); - } -} \ No newline at end of file diff --git a/src/resources/Mass.java b/src/resources/Mass.java deleted file mode 100644 index c0acc82..0000000 --- a/src/resources/Mass.java +++ /dev/null @@ -1,19 +0,0 @@ -package resources; - -public class Mass { - private Acceleration acceleration; - private double value; - - public Mass(Acceleration acceleration) { - this.acceleration = acceleration; - } - - public void setValue(double x) { - this.value = x; - acceleration.updateByMass(value); - } - - public double getValue() { - return value; - } -} \ No newline at end of file diff --git a/src/resources/Move.java b/src/resources/Move.java deleted file mode 100644 index 20be320..0000000 --- a/src/resources/Move.java +++ /dev/null @@ -1,23 +0,0 @@ -package resources; - -public class Move { - private Velocity velocity; - private Vector2 value; - - public Move(Velocity velocity) { - this.velocity = velocity; - } - - public void moveX(double x) { - this.value = new Vector2(x, this.value.getY()); - velocity.updateByMove(value); - } - - public void moveY(double y) { - this.value = new Vector2(this.value.getX(), y); - } - - public Vector2 getValue() { - return value; - } -} \ No newline at end of file diff --git a/src/resources/Onground.java b/src/resources/Onground.java deleted file mode 100644 index de8ece5..0000000 --- a/src/resources/Onground.java +++ /dev/null @@ -1,14 +0,0 @@ -package resources; - -public class Onground { - private Ground ground; - private Position position; - - public Onground(Ground ground, Position position) { - this.ground = ground; - this.position = position; - } - - public boolean getOnground() { - return ((this.ground.getValue() == true) && (this.position.getValue().getY() <= 0.0)); } -} \ No newline at end of file diff --git a/src/resources/Position.java b/src/resources/Position.java deleted file mode 100644 index d890660..0000000 --- a/src/resources/Position.java +++ /dev/null @@ -1,24 +0,0 @@ -package resources; - -public class Position { - private Ground ground; - private Vector2 value; - - public void updateByVelocity(Vector2 velocity) { - Vector2 temp_l3; - if (((this.ground.getValue() == true) && ((this.value.getY() + (0.01 * velocity.getY())) < 0.0))) { - temp_l3 = new Vector2((this.value.getX() + (0.01 * velocity.getX())), 0.0); - } else { - temp_l3 = new Vector2((this.value.getX() + (0.01 * velocity.getX())), (this.value.getY() + (0.01 * velocity.getY()))); - } - value = temp_l3; - } - - public Position(Ground ground) { - this.ground = ground; - } - - public Vector2 getValue() { - return value; - } -} \ No newline at end of file diff --git a/src/resources/Time.java b/src/resources/Time.java deleted file mode 100644 index 3ba6de2..0000000 --- a/src/resources/Time.java +++ /dev/null @@ -1,13 +0,0 @@ -package resources; - -public class Time { - private double value; - - public void gravity(double y) { - this.value = (this.value + 0.01); - } - - public double getValue() { - return value; - } -} \ No newline at end of file diff --git a/src/resources/Vector2.java b/src/resources/Vector2.java deleted file mode 100644 index 8b97696..0000000 --- a/src/resources/Vector2.java +++ /dev/null @@ -1,19 +0,0 @@ -package resources; - -public class Vector2 { - private double x; - private double y; - - public Vector2(double x, double y) { - this.x = x; - this.y = y; - } - - public double getX() { - return this.x; - } - - public double getY() { - return this.y; - } -} diff --git a/src/resources/Velocity.java b/src/resources/Velocity.java deleted file mode 100644 index fcae09b..0000000 --- a/src/resources/Velocity.java +++ /dev/null @@ -1,42 +0,0 @@ -package resources; - -public class Velocity { - private Vector2 moveValue; - private Vector2 accelerationValue; - private Position position; - private Onground onground; - private Vector2 value; - - public void updateByMove(Vector2 move) { - this.moveValue = move; - Vector2 temp_l2; - if ((this.onground.getOnground() && (move.getY() >= 0.0))) { - temp_l2 = move; - } else { - temp_l2 = this.value; - } - value = temp_l2; - position.updateByVelocity(value); - } - - public void updateByAcceleration(Vector2 acceleration) { - this.accelerationValue = acceleration; - Vector2 temp_l5; - if ((this.onground.getOnground() && (this.value.getY() < 0.0))) { - temp_l5 = new Vector2((this.value.getX() + (0.01 * acceleration.getX())), 0.0); - } else { - temp_l5 = new Vector2((this.value.getX() + (0.01 * acceleration.getX())), (this.value.getY() + (0.01 * acceleration.getY()))); - } - value = temp_l5; - position.updateByVelocity(value); - } - - public Velocity(Position position, Onground onground) { - this.position = position; - this.onground = onground; - } - - public Vector2 getValue() { - return value; - } -} \ No newline at end of file