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

Correct reload and fire.

parent cf4ad40e
Branches master
No related merge requests found
......@@ -73,37 +73,35 @@ public class BulletAnimated implements DrawableSimulable, Collisionable{
position = new Point2D(position.getX(), size / 2);
}
} else {
fire();
reload();
}
}
public Rectangle2D getBoundingBox() {
return new Rectangle2D(position.getX(), position.getY() - size, size, size);
}
public boolean overlaps(Dragon dragon) {
return getBoundingBox().intersects(dragon.getBoundingBox());
}
public void hitBy(Collisionable other) {
reload();
fire();
}
public void reload() {
position = start;
speed = initialSpeed;
hitToGround = false;
accelerate = true;
}
public void setCanonPower(double value) {
strenghtOfCannon = value;
}
public void fire() {
reload();
accelerate = true;
}
}
......@@ -19,7 +19,6 @@ public class GameController {
animationTimer = new DrawingThread(canvas, world);
animationTimer.start();
world.setCannonAngle(-45d);
world.setCannonPower(100.);
world.fireBullet();
......
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