diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 30ddc78..f9c7b45 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,41 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -18,6 +52,9 @@
+
+
+
@@ -28,6 +65,7 @@
+
@@ -35,9 +73,15 @@
+
+
+
+
+
+
@@ -61,7 +105,7 @@
-
+
1646804917199
@@ -70,6 +114,7 @@
+
1648974204548
diff --git a/resources/stage.txt b/resources/stage.txt
index eaed1d1..e886f9f 100644
--- a/resources/stage.txt
+++ b/resources/stage.txt
@@ -1 +1 @@
-1,2,1,1,1,1,1,1,2,1
\ No newline at end of file
+1,2,4,6,7,20,40,60,100
\ No newline at end of file
diff --git a/src/main/java/JumpGame.java b/src/main/java/JumpGame.java
index afc1a43..aee1977 100644
--- a/src/main/java/JumpGame.java
+++ b/src/main/java/JumpGame.java
@@ -21,6 +21,7 @@
//
public void gravity(double y) {
JumpGameModel jumpGameModel = (JumpGameModel) model;
+ jumpGameModel.moveX(1);
jumpGameModel.gravity(y); //重力の更新
jumpGameModel.updateGroundFlag();//地面の判定切り替え
}
@@ -36,10 +37,10 @@
//---------------------------------------------------------------
// 更新処理
public void update(long window) {
- JumpGameModel jumpGameModel = (JumpGameModel) model;
// Viewの更新
for (IView view : views) {
+ JumpGameModel jumpGameModel = (JumpGameModel) model;
view.update(model);
view.display();
}
@@ -50,13 +51,13 @@
@Override
public void invoke(long window, int key, int scancode, int action, int mods) {
if (key == GLFW_KEY_SPACE && action != GLFW_PRESS) {
+ JumpGameModel jumpGameModel = (JumpGameModel) model;
jumpGameModel.moveY(256);
// System.out.println("jumping");
}
}
});
- jumpGameModel.moveX(1);
gravity(-256); //重力
}
diff --git a/src/main/java/entities/Acceleration.java b/src/main/java/entities/Acceleration.java
index a0e330e..5d52dfd 100644
--- a/src/main/java/entities/Acceleration.java
+++ b/src/main/java/entities/Acceleration.java
@@ -1,5 +1,4 @@
package entities;
-import java.util.*;
public class Acceleration {
private Pair force = new Pair<>(0.0,0.0);
@@ -9,24 +8,24 @@
private Pair value = new Pair<>(0.0,0.0);
public void updateForce(Pair force) {
this.force = force;
- Pair temp_if0;
+ Pair temp_if10;
if (this.onground.getValue()) {
- temp_if0 = new Pair<>((force.getLeft()/mass),0.0);
+ temp_if10 = new Pair<>((force.getLeft()/mass),0.0);
} else {
- temp_if0 = new Pair<>((force.getLeft()/mass),(force.getRight()/mass));
+ temp_if10 = new Pair<>((force.getLeft()/mass),(force.getRight()/mass));
}
- value = temp_if0;
+ value = temp_if10;
velocity.updateAcceleration(value);
}
public void updateMass(double mass) {
this.mass = mass;
- Pair temp_if2;
+ Pair temp_if13;
if (this.onground.getValue()) {
- temp_if2 = new Pair<>((force.getLeft()/mass),0.0);
+ temp_if13 = new Pair<>((force.getLeft()/mass),0.0);
} else {
- temp_if2 = new Pair<>((force.getLeft()/mass),(force.getRight()/mass));
+ temp_if13 = new Pair<>((force.getLeft()/mass),(force.getRight()/mass));
}
- value = temp_if2;
+ value = temp_if13;
velocity.updateAcceleration(value);
}
public Acceleration(Velocity velocity, Onground onground) {
diff --git a/src/main/java/entities/Clear.java b/src/main/java/entities/Clear.java
index 8ed248c..8359ee9 100644
--- a/src/main/java/entities/Clear.java
+++ b/src/main/java/entities/Clear.java
@@ -5,13 +5,13 @@
public class Clear {
private boolean value = false;
public void updatePosition(Pair position) {
- boolean temp_if5;
+ boolean temp_if11;
if ((position.getLeft()>100.0)) {
- temp_if5 = true;
+ temp_if11 = true;
} else {
- temp_if5 = false;
+ temp_if11 = false;
}
- value = temp_if5;
+ value = temp_if11;
}
public boolean getValue() {
return value;
diff --git a/src/main/java/entities/Force.java b/src/main/java/entities/Force.java
index 5e8897f..b46046d 100644
--- a/src/main/java/entities/Force.java
+++ b/src/main/java/entities/Force.java
@@ -1,7 +1,5 @@
package entities;
-import java.util.*;
-
public class Force {
private Acceleration acceleration;
private Pair value = new Pair<>(0.0,0.0);
diff --git a/src/main/java/entities/Gameover.java b/src/main/java/entities/Gameover.java
index babc4ae..3cbee90 100644
--- a/src/main/java/entities/Gameover.java
+++ b/src/main/java/entities/Gameover.java
@@ -1,16 +1,17 @@
package entities;
+
import java.util.*;
public class Gameover {
private boolean value = false;
public void updatePosition(Pair position) {
- boolean temp_if6;
+ boolean temp_if12;
if ((position.getRight()<-(1.0))) {
- temp_if6 = true;
+ temp_if12 = true;
} else {
- temp_if6 = false;
+ temp_if12 = false;
}
- value = temp_if6;
+ value = temp_if12;
}
public boolean getValue() {
return value;
diff --git a/src/main/java/entities/Ground.java b/src/main/java/entities/Ground.java
index 69c5290..15083ea 100644
--- a/src/main/java/entities/Ground.java
+++ b/src/main/java/entities/Ground.java
@@ -1,21 +1,19 @@
package entities;
-import java.util.*;
-
public class Ground {
private Onground onground;
private boolean value = true;
public Ground(Onground onground) {
this.onground = onground;
}
- public void openHole() {
- this.value = false;
- onground.updateGround(value);
- }
public void closeHole() {
this.value = true;
onground.updateGround(value);
}
+ public void openHole() {
+ this.value = false;
+ onground.updateGround(value);
+ }
public boolean getValue() {
return value;
}
diff --git a/src/main/java/entities/Mass.java b/src/main/java/entities/Mass.java
index d8dd95d..bec20c3 100644
--- a/src/main/java/entities/Mass.java
+++ b/src/main/java/entities/Mass.java
@@ -1,5 +1,4 @@
package entities;
-import java.util.*;
public class Mass {
private Acceleration acceleration;
diff --git a/src/main/java/entities/Move.java b/src/main/java/entities/Move.java
index b91e605..25ec155 100644
--- a/src/main/java/entities/Move.java
+++ b/src/main/java/entities/Move.java
@@ -4,16 +4,16 @@
public class Move {
private Velocity velocity;
- private Pair value = new Pair<>(0.0,0.0);
+ private Pair value = new Pair<>(1.0,0.0);
public Move(Velocity velocity) {
this.velocity = velocity;
}
- public void moveY(double y) {
- this.value = new Pair<>(this.value.getLeft(),y);
+ public void moveX(double x) {
+ this.value = new Pair<>(x,0d);
velocity.updateMove(value);
}
- public void moveX(double x) {
- this.value = new Pair<>(x,this.value.getRight());
+ public void moveY(double y) {
+ this.value = new Pair<>(this.value.getLeft(),y);
velocity.updateMove(value);
}
public Pair getValue() {
diff --git a/src/main/java/entities/Onground.java b/src/main/java/entities/Onground.java
index 9a54eb0..94c09a2 100644
--- a/src/main/java/entities/Onground.java
+++ b/src/main/java/entities/Onground.java
@@ -3,17 +3,17 @@
import java.util.*;
public class Onground {
- private boolean ground = true;
private Pair position = new Pair<>(0.0,0.0);
+ private boolean ground = true;
private boolean value = true;
- public void updateGround(boolean ground) {
- this.ground = ground;
- value = ((ground==true)&&(position.getRight()<=0.0));
- }
public void updatePosition(Pair position) {
this.position = position;
value = ((ground==true)&&(position.getRight()<=0.0));
}
+ public void updateGround(boolean ground) {
+ this.ground = ground;
+ value = ((ground==true)&&(position.getRight()<=0.0));
+ }
public boolean getValue() {
return value;
}
diff --git a/src/main/java/entities/Position.java b/src/main/java/entities/Position.java
index 03b164c..44b1870 100644
--- a/src/main/java/entities/Position.java
+++ b/src/main/java/entities/Position.java
@@ -1,5 +1,4 @@
package entities;
-import java.util.*;
public class Position {
private Onground onground;
@@ -8,13 +7,13 @@
private Ground ground;
private Pair value = new Pair<>(0.0,0.0);
public void updateVelocity(Pair velocity) {
- Pair temp_if4;
+ Pair temp_if9;
if (((this.ground.getValue()==true)&&((this.value.getRight()+(0.01*velocity.getRight()))<0.0))) {
- temp_if4 = new Pair<>((this.value.getLeft()+(0.01*velocity.getLeft())),0.0);
+ temp_if9 = new Pair<>((this.value.getLeft()+(0.01*velocity.getLeft())),0.0);
} else {
- temp_if4 = new Pair<>((this.value.getLeft()+(0.01*velocity.getLeft())),(this.value.getRight()+(0.01*velocity.getRight())));
+ temp_if9 = new Pair<>((this.value.getLeft()+(0.01*velocity.getLeft())),(this.value.getRight()+(0.01*velocity.getRight())));
}
- value = temp_if4;
+ value = temp_if9;
onground.updatePosition(value);
clear.updatePosition(value);
gameover.updatePosition(value);
diff --git a/src/main/java/entities/Time.java b/src/main/java/entities/Time.java
index 5ee12e9..fe1d7f2 100644
--- a/src/main/java/entities/Time.java
+++ b/src/main/java/entities/Time.java
@@ -1,4 +1,5 @@
package entities;
+
import java.util.*;
public class Time {
diff --git a/src/main/java/entities/Velocity.java b/src/main/java/entities/Velocity.java
index 1d9d6ff..8ba58e9 100644
--- a/src/main/java/entities/Velocity.java
+++ b/src/main/java/entities/Velocity.java
@@ -1,33 +1,31 @@
package entities;
-import java.util.*;
-
public class Velocity {
- private Pair move = new Pair<>(0.0,0.0);
private Pair acceleration = new Pair<>(0.0,0.0);
+ private Pair move = new Pair<>(1.0,0.0);
private Position position;
private Onground onground;
private Pair value = new Pair<>(0.0,0.0);
- public void updateMove(Pair move) {
- this.move = move;
- Pair temp_if1;
- if ((this.onground.getValue()&&(move.getRight()>=0.0))) {
- temp_if1 = move;
- } else {
- temp_if1 = this.value;
- }
- value = temp_if1;
- position.updateVelocity(value);
- }
public void updateAcceleration(Pair acceleration) {
this.acceleration = acceleration;
- Pair temp_if3;
+ Pair temp_if7;
if ((this.onground.getValue()&&(this.value.getRight()<0.0))) {
- temp_if3 = new Pair<>((this.value.getLeft()+(0.01*acceleration.getLeft())),0.0);
+ temp_if7 = new Pair<>((this.value.getLeft()+(0.01*acceleration.getLeft())),0.0);
} else {
- temp_if3 = new Pair<>((this.value.getLeft()+(0.01*acceleration.getLeft())),(this.value.getRight()+(0.01*acceleration.getRight())));
+ temp_if7 = new Pair<>((this.value.getLeft()+(0.01*acceleration.getLeft())),(this.value.getRight()+(0.01*acceleration.getRight())));
}
- value = temp_if3;
+ value = temp_if7;
+ position.updateVelocity(value);
+ }
+ public void updateMove(Pair move) {
+ this.move = move;
+ Pair temp_if8;
+ if ((this.onground.getValue()&&(move.getRight()>=0.0))) {
+ temp_if8 = move;
+ } else {
+ temp_if8 = this.value;
+ }
+ value = temp_if8;
position.updateVelocity(value);
}
public Velocity(Position position, Onground onground) {
diff --git a/src/main/java/models/JumpGameModel.java b/src/main/java/models/JumpGameModel.java
index 5c98ecb..b50a0fe 100644
--- a/src/main/java/models/JumpGameModel.java
+++ b/src/main/java/models/JumpGameModel.java
@@ -45,6 +45,7 @@
this.ground.closeHole();
}
public void moveY(double y) {
+ System.out.println("jumping");
this.move.moveY(y);
}
public void moveX(double x) {
@@ -102,8 +103,8 @@
if (stage.isCloseFlag(x)) ground.closeHole();
// System.out.print("x: " + x + "/");
-// System.out.println("Ground: " + ground.getValue() + "/");
-// System.out.print("Clear: " + clear.getClear() + "/");
+// System.out.println("entities.Ground: " + ground.getValue() + "/");
+// System.out.print("entities.Clear: " + clear.getClear() + "/");
// System.out.println("GameOver: " + gameover.getGameover());
}
diff --git a/src/main/java/views/Image2D.java b/src/main/java/views/Image2D.java
index 69c8684..f8e6aeb 100644
--- a/src/main/java/views/Image2D.java
+++ b/src/main/java/views/Image2D.java
@@ -1,7 +1,7 @@
package views;
-import entities.config.GLConfigVariable;
import entities.Pair;
+import entities.config.GLConfigVariable;
import static org.lwjgl.opengl.GL11.*;
diff --git a/src/main/java/views/TileMapRenderer.java b/src/main/java/views/TileMapRenderer.java
index b7d4c64..8d59322 100644
--- a/src/main/java/views/TileMapRenderer.java
+++ b/src/main/java/views/TileMapRenderer.java
@@ -63,7 +63,10 @@
double x = 32 * newTile.getScaleValue() * (i + space);
// フラグのチェック
- if (stage.isFlag(i)) isOpen = !isOpen;
+ if (stage.isFlag(i)){
+ isOpen = !isOpen;
+ System.out.println(isOpen);
+ }
// タイルの切り替え
if (isOpen) addNewTile(x, TileType.OPEN);
diff --git a/target/classes/JumpGame$1.class b/target/classes/JumpGame$1.class
index d960a73..5a87004 100644
--- a/target/classes/JumpGame$1.class
+++ b/target/classes/JumpGame$1.class
Binary files differ
diff --git a/target/classes/JumpGame.class b/target/classes/JumpGame.class
index c3e55cc..579e841 100644
--- a/target/classes/JumpGame.class
+++ b/target/classes/JumpGame.class
Binary files differ
diff --git a/target/classes/entities/Acceleration.class b/target/classes/entities/Acceleration.class
index 0fccb01..82f9c2d 100644
--- a/target/classes/entities/Acceleration.class
+++ b/target/classes/entities/Acceleration.class
Binary files differ
diff --git a/target/classes/entities/Clear.class b/target/classes/entities/Clear.class
index 3185412..49f31e5 100644
--- a/target/classes/entities/Clear.class
+++ b/target/classes/entities/Clear.class
Binary files differ
diff --git a/target/classes/entities/Force.class b/target/classes/entities/Force.class
index 0844a3b..bd8960f 100644
--- a/target/classes/entities/Force.class
+++ b/target/classes/entities/Force.class
Binary files differ
diff --git a/target/classes/entities/Gameover.class b/target/classes/entities/Gameover.class
index 3679e22..aa05ce4 100644
--- a/target/classes/entities/Gameover.class
+++ b/target/classes/entities/Gameover.class
Binary files differ
diff --git a/target/classes/entities/Ground.class b/target/classes/entities/Ground.class
index 3defb58..e840860 100644
--- a/target/classes/entities/Ground.class
+++ b/target/classes/entities/Ground.class
Binary files differ
diff --git a/target/classes/entities/Mass.class b/target/classes/entities/Mass.class
index 57803d1..feab936 100644
--- a/target/classes/entities/Mass.class
+++ b/target/classes/entities/Mass.class
Binary files differ
diff --git a/target/classes/entities/Move.class b/target/classes/entities/Move.class
index ada3806..4c83aec 100644
--- a/target/classes/entities/Move.class
+++ b/target/classes/entities/Move.class
Binary files differ
diff --git a/target/classes/entities/Onground.class b/target/classes/entities/Onground.class
index 8c41ae3..e9e89c8 100644
--- a/target/classes/entities/Onground.class
+++ b/target/classes/entities/Onground.class
Binary files differ
diff --git a/target/classes/entities/Position.class b/target/classes/entities/Position.class
index e222e1d..f3bbf44 100644
--- a/target/classes/entities/Position.class
+++ b/target/classes/entities/Position.class
Binary files differ
diff --git a/target/classes/entities/Time.class b/target/classes/entities/Time.class
index d265d22..d2a3a84 100644
--- a/target/classes/entities/Time.class
+++ b/target/classes/entities/Time.class
Binary files differ
diff --git a/target/classes/entities/Velocity.class b/target/classes/entities/Velocity.class
index f097e46..56be197 100644
--- a/target/classes/entities/Velocity.class
+++ b/target/classes/entities/Velocity.class
Binary files differ
diff --git a/target/classes/models/JumpGameModel.class b/target/classes/models/JumpGameModel.class
index b933322..fb8dd06 100644
--- a/target/classes/models/JumpGameModel.class
+++ b/target/classes/models/JumpGameModel.class
Binary files differ
diff --git a/target/classes/views/TileMapRenderer$1.class b/target/classes/views/TileMapRenderer$1.class
index 1fe3bef..3bbcf10 100644
--- a/target/classes/views/TileMapRenderer$1.class
+++ b/target/classes/views/TileMapRenderer$1.class
Binary files differ
diff --git a/target/classes/views/TileMapRenderer.class b/target/classes/views/TileMapRenderer.class
index f869cdc..001199a 100644
--- a/target/classes/views/TileMapRenderer.class
+++ b/target/classes/views/TileMapRenderer.class
Binary files differ