error OutsideWorld
This commit is contained in:
@@ -80,10 +80,9 @@ public abstract class Projectile extends GameObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double jumpVelocity() {
|
private double jumpVelocity() {
|
||||||
return getForce() / (getMass() / 1000) * FORCE_TIME;
|
return (getForce() / (getMass() / 1000)) * FORCE_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO jumpTimeStep moet nog toegepast worden!
|
|
||||||
public double getJumpTime(double jumpTimeStep) {
|
public double getJumpTime(double jumpTimeStep) {
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
|
|
||||||
@@ -99,7 +98,7 @@ public abstract class Projectile extends GameObject {
|
|||||||
Coordinate newLoc;
|
Coordinate newLoc;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
time += 0.05;
|
time += jumpTimeStep;
|
||||||
double x = loc.getX() + v * time * cos(a);
|
double x = loc.getX() + v * time * cos(a);
|
||||||
double y = loc.getY() + v * time * sin(a) - (G * time * time) / 2.0;
|
double y = loc.getY() + v * time * sin(a) - (G * time * time) / 2.0;
|
||||||
newLoc = Coordinate.create(x, y);
|
newLoc = Coordinate.create(x, y);
|
||||||
@@ -155,7 +154,8 @@ public abstract class Projectile extends GameObject {
|
|||||||
|
|
||||||
for (Worm worm: worms) {
|
for (Worm worm: worms) {
|
||||||
if (this.getDistance(worm) < 0) {
|
if (this.getDistance(worm) < 0) {
|
||||||
hit(worm);
|
setLocation(newLocation);
|
||||||
|
hit(worm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user