From 18b326281c7a6bf28115da8ef27d2855e0be0d36 Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Fri, 4 May 2018 14:27:00 +0200 Subject: [PATCH] Functies Worm --- OGP1718-Worms/src/worms/model/Projectile.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 OGP1718-Worms/src/worms/model/Projectile.java diff --git a/OGP1718-Worms/src/worms/model/Projectile.java b/OGP1718-Worms/src/worms/model/Projectile.java new file mode 100644 index 0000000..412c49e --- /dev/null +++ b/OGP1718-Worms/src/worms/model/Projectile.java @@ -0,0 +1,30 @@ +package worms.model; + +public class Projectile extends GameObject { + private static double rho = 7800; + private double hitpoints; + private double force; + + public Projectile(World world, double[] location, double mass, double hitpoints, double force) { + super(world, location, calcRadius(mass)); + setHitPoints(hitpoints); + setMass(mass); + setForce(force); + } + + public static double calcRadius(double mass) { + return Math.cbrt(mass/(4/3*Math.PI*rho)); + } + + public void setHitPoints(double value) { + this.hitpoints = value; + } + + public void setMass(double mass) { + this.mass = mass; + } + + public void setForce(double force) { + this.force = force; + } +}