diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9c32aad..2d58001 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,52 +4,11 @@
-
-
+
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -115,17 +74,6 @@
-
-
-
-
-
-
-
@@ -146,7 +94,8 @@
-
+
+
1648974204548
@@ -169,7 +118,14 @@
1650351804114
-
+
+ 1650884746927
+
+
+
+ 1650884746927
+
+
@@ -191,7 +147,8 @@
-
+
+
diff --git a/resources/stage.txt b/resources/stage.txt
index f6ff4d2..586e10f 100644
--- a/resources/stage.txt
+++ b/resources/stage.txt
@@ -1 +1 @@
-1,4,7,10,24,28,40,42,48,50,62,66,68,74,80,82,85,90,94,100
\ No newline at end of file
+7,10,20,22,26,30,40,44,50,52,60,64,68,70,80,83,90,92,95,98
\ No newline at end of file
diff --git a/src/main/java/JumpingGame.java b/src/main/java/JumpingGame.java
index 67beb34..3416d47 100644
--- a/src/main/java/JumpingGame.java
+++ b/src/main/java/JumpingGame.java
@@ -5,6 +5,7 @@
import views.PlayerRenderer;
import views.TileMapRenderer;
+import javax.swing.*;
import java.util.ArrayList;
import static org.lwjgl.glfw.GLFW.*;
@@ -23,8 +24,10 @@
}
public void init() {
+ model = new JumpingGameModel();
JumpingGameModel jumpingGameModel = (JumpingGameModel) model;
jumpingGameModel.run(2);
+
views.add(new TileMapRenderer(model));
views.add(new PlayerRenderer("resources/JCasC.png"));
}
@@ -46,10 +49,32 @@
}
});
+ gameClear();
+ gameOver();
gravity(-256);
+
}
public void delete() {
for (IView view : views) view.delete();
}
+
+ private void gameClear(){
+ JumpingGameModel jumpingGameModel = (JumpingGameModel) model;
+ if(jumpingGameModel.getClear()){
+ JFrame jFrame = new JFrame();
+ JOptionPane.showMessageDialog(jFrame, "Clear");
+ init();
+ }
+ }
+
+ private void gameOver(){
+ JumpingGameModel jumpingGameModel = (JumpingGameModel) model;
+ if(jumpingGameModel.getGameover()){
+ JFrame jFrame = new JFrame();
+ JOptionPane.showMessageDialog(jFrame, "GameOver");
+ init();
+ }
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/entities/Gameover.java b/src/main/java/entities/Gameover.java
index 15fb248..9d6cd43 100644
--- a/src/main/java/entities/Gameover.java
+++ b/src/main/java/entities/Gameover.java
@@ -4,7 +4,7 @@
private boolean value = false;
public void updatePosition(Pair position) {
boolean temp_if0;
- if ((position.getRight()<-(1.0))) {
+ if ((position.getRight()<-(100))) {
temp_if0 = true;
} else {
temp_if0 = false;
diff --git a/src/main/java/entities/Movex.java b/src/main/java/entities/Movex.java
new file mode 100644
index 0000000..d0d9ebc
--- /dev/null
+++ b/src/main/java/entities/Movex.java
@@ -0,0 +1,16 @@
+package entities;
+
+public class Movex {
+ private Velocity velocity;
+ private double value;
+ public Movex(Velocity velocity) {
+ this.velocity = velocity;
+ }
+ public void run(double x2) {
+ this.value = x2;
+ velocity.updateMovex(value);
+ }
+ public double getValue() {
+ return value;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/entities/Movey.java b/src/main/java/entities/Movey.java
new file mode 100644
index 0000000..c812b90
--- /dev/null
+++ b/src/main/java/entities/Movey.java
@@ -0,0 +1,16 @@
+package entities;
+
+public class Movey {
+ private Velocity velocity;
+ private double value;
+ public Movey(Velocity velocity) {
+ this.velocity = velocity;
+ }
+ public void jump(double y2) {
+ this.value = y2;
+ velocity.updateMovey(value);
+ }
+ public double getValue() {
+ return value;
+ }
+}
\ No newline at end of file
diff --git a/target/classes/entities/Movex.class b/target/classes/entities/Movex.class
new file mode 100644
index 0000000..f42cd44
--- /dev/null
+++ b/target/classes/entities/Movex.class
Binary files differ
diff --git a/target/classes/entities/Movey.class b/target/classes/entities/Movey.class
new file mode 100644
index 0000000..e77d426
--- /dev/null
+++ b/target/classes/entities/Movey.class
Binary files differ
diff --git a/target/classes/models/JumpingGameModel.class b/target/classes/models/JumpingGameModel.class
new file mode 100644
index 0000000..e9de92b
--- /dev/null
+++ b/target/classes/models/JumpingGameModel.class
Binary files differ