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