Skip to content
Snippets Groups Projects
Verified Commit beea69a8 authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Fix speed

parent 03979e13
Branches
No related merge requests found
......@@ -5,7 +5,7 @@ import javafx.geometry.Rectangle2D;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.image.Image;
public class BulletAnimated {
public class BulletAnimated {
private Point2D position;
private Point2D start;
......@@ -13,7 +13,7 @@ public class BulletAnimated {
private Point2D initialSpeed;
private double size;
private double mass = 2;
private double strenghtOfCannon = .1;
private double strenghtOfCannon = 2;
private double cannonLength = 100;
private boolean accelerate = true;
private boolean hitToGround = false;
......@@ -54,7 +54,7 @@ public class BulletAnimated {
double cannonAngle = cannon.getAngle();
speed = speed
.add(new Point2D(Math.cos(cannonAngle) * strenghtOfCannon, Math.sin(cannonAngle) * strenghtOfCannon)
.multiply(1 / mass).multiply(timeStep));
.multiply(1 / mass));
} else if (!hitToGround) {
accelerate = false;
Point2D airResistanceforce = new Point2D(
......@@ -85,6 +85,7 @@ public class BulletAnimated {
return getBoundingBox().intersects(dragon.getBoundingBox());
}
public void reload() {
position = start;
speed = initialSpeed;
......
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