diff --git a/pom.xml b/pom.xml
index 6a922506d20f676dda22a51fffc6296c71f48044..06b4758c4a31c2ae061a89af9499e4aa15960732 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>vsb-cs-java1</groupId>
- <artifactId>lab02</artifactId>
+ <artifactId>lab03</artifactId>
<version>0.0.1-SNAPHOST</version>
<packaging>jar</packaging>
<properties>
@@ -22,26 +22,36 @@
<artifactId>javafx-fxml</artifactId>
<version>23</version>
</dependency>
- <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
+ <!--
+ https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
- <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
+ <!--
+ https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
- <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-params -->
+ <!--
+ https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-params -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
+ <!-- https://mvnrepository.com/artifact/org.reflections/reflections -->
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <version>0.10.2</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/src/main/java/lab/Cannon.java b/src/main/java/lab/Cannon.java
index d0248ce9c00ceb71d5bc80d5787d26bebb2a1ae7..0a1cf1746c5f2b37865d7231ec375ff705478e5a 100644
--- a/src/main/java/lab/Cannon.java
+++ b/src/main/java/lab/Cannon.java
@@ -13,7 +13,7 @@ public class Cannon {
private final World world;
private Point2D position;
private double angle;
- private double angleDelta = 25;
+ private double angleDelta = -25;
public Cannon(World world, Point2D position, double angle) {
this.world = world;
@@ -32,7 +32,7 @@ public class Cannon {
public void simulate(double deltaT) {
// do nothing yet
angle += angleDelta * deltaT;
- if (angle >= 90 || angle <= 0) {
+ if (angle >= 0 || angle <= -90) {
angleDelta = -angleDelta;
}
}
diff --git a/src/main/java/lab/World.java b/src/main/java/lab/World.java
index 8266a75810c023d1514326c66b36e3fb66a67faa..3417a426a6350a8de5e55c437b5c22aa381d7225 100644
--- a/src/main/java/lab/World.java
+++ b/src/main/java/lab/World.java
@@ -7,27 +7,24 @@ public class World {
private final double width;
- private final double hight;
+ private final double height;
private final Bullet bullet;
private final BulletAnimated bullet2;
private final Cannon cannon;
- public World(double width, double hight) {
+ public World(double width, double height) {
this.width = width;
- this.hight = hight;
- bullet = new Bullet(this, new Point2D(0, 0), new Point2D(30, 30), new Point2D(0, -9.81));
- bullet2 = new BulletAnimated(this, new Point2D(0, 0), new Point2D(30, 70), new Point2D(0, -9.81));
- cannon = new Cannon(this, new Point2D(0, 0), 45);
+ this.height = height;
+ bullet = new Bullet(this, new Point2D(0, height), new Point2D(30, -30), new Point2D(0, 9.81));
+ bullet2 = new BulletAnimated(this, new Point2D(0, height), new Point2D(50, -80), new Point2D(0, 9.81));
+ cannon = new Cannon(this, new Point2D(0, height-20), -45);
}
public void draw(GraphicsContext gc) {
- gc.clearRect(0, 0, width, hight);
+ gc.clearRect(0, 0, width, height);
gc.save();
- // Change coordinate system to human like
- gc.scale(1, -1);
- gc.translate(0, -hight);
bullet.draw(gc);
bullet2.draw(gc);
cannon.draw(gc);
@@ -39,4 +36,13 @@ public class World {
bullet2.simulate(deltaT);
cannon.simulate(deltaT);
}
+
+ public double getWidth() {
+ return width;
+ }
+
+ public double getHeight() {
+ return height;
+ }
+
}
\ No newline at end of file