Skip to content
Snippets Groups Projects
Commit df128fe6 authored by jez04's avatar jez04
Browse files

fix: use delay

parent 7bb16461
Branches
No related merge requests found
......@@ -20,7 +20,7 @@ public class Level {
nicerObstacle = new NicerObstacle(this, new Point2D(20, 150));
obstacle1 = new Obstacle(this, new Point2D(300, 200), new Dimension2D(80, 40));
obstacle2 = new Obstacle(this);
player = new Player(this, new Point2D(20, 250), new Point2D(0.5, -0.1));
player = new Player(this, new Point2D(20, 250), new Point2D(100, -20));
}
public void draw(GraphicsContext gc) {
......@@ -33,7 +33,7 @@ public class Level {
}
public void simulate(double delay) {
player.simulate(0);
player.simulate(delay);
}
}
......@@ -36,8 +36,8 @@ public class Player {
}
public void simulate(double delay) {
position = position.add(speed);
speed = speed.multiply(0.998);
position = position.add(speed.multiply(delay/1_000_000_000));
speed = speed.multiply(0.9994);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment