Skip to content

Commit

Permalink
change Water physic characteristics and try to change Material influence
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgivrer committed May 5, 2024
1 parent 5fb3a6b commit a4ac85c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/my/karma/app/KarmaPlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -1748,6 +1748,7 @@ private void applyWorldDisturbance(World world, Entity entity, double d) {
if (dist.box.intersects(entity.box) || dist.box.contains(entity.box)) {
// TODO add forces and acceleration to Entity.
entity.forces.addAll(dist.forces);
//entity.velocity = entity.velocity.multiply(dist.getMaterial().friction);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/my/karma/app/scenes/PlayScene.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ public void create(KarmaPlatform app) {
.setPosition(0, 0)
.setSize(w.getPlayArea().getWidth(), w.getPlayArea().getHeight() * 0.8)
.addForce(new KarmaPlatform.Vector2D(0.0002, 0.0))
);
.setMaterial(KarmaPlatform.Material.DEFAULT));
w.addDisturbance((KarmaPlatform.Disturbance)
new KarmaPlatform.Disturbance("mag")
.setPosition(0, 0)
.setSize(w.getPlayArea().getWidth() * 0.15, w.getPlayArea().getHeight())
.setForegroundColor(new Color(0.7f, 0.6f, 0.0f, 0.5f))
.setBackgroundColor(new Color(0.7f, 0.6f, 0.0f, 0.5f))
.addForce(new KarmaPlatform.Vector2D(-0.002, -0.012))
.setMaterial(KarmaPlatform.Material.DEFAULT)
);
createPlatforms(app);

Expand All @@ -54,7 +55,7 @@ public void create(KarmaPlatform app) {
.setMaterial(
new KarmaPlatform.Material(
"water",
0.98, 1.0, 0.2))
0.90, 0.6, 0.2))
.setPosition(16, (w.getPlayArea().getHeight() * 0.75))
.setSize(w.getPlayArea().getWidth() - 32, (w.getPlayArea().getHeight() * 0.25) - 32)
.setForegroundColor(new Color(0.0f, 0.0f, 0.8f, 0.5f))
Expand Down

0 comments on commit a4ac85c

Please sign in to comment.