Skip to content
Snippets Groups Projects
Commit 4ef5be7b authored by jez04's avatar jez04
Browse files

feat: assignment lab 04

parent dbab0775
Branches master
No related merge requests found
Pipeline #2552 failed with stages
......@@ -3,9 +3,9 @@
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>cz.vsb.fei.java2</groupId>
<artifactId>java2-lab03-v2</artifactId>
<artifactId>java2-lab04-v2</artifactId>
<version>0.0.1-SNAPHOST</version>
<name>java2-lab03-v2</name>
<name>java2-lab04-v2</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......
......@@ -27,10 +27,8 @@ public class Monster extends WorldEntity implements Collisionable {
public Monster(Level level) {
super(level, new Point2D(0, 0), 100);
image = new Image(getClass().getResourceAsStream("red-monster.gif"));
position = new Point2D(
level.getWidth() * Config.getInstance().getMonsterMinXPopsition() + RANDOM.nextDouble(
level.getWidth() - image.getWidth()),
RANDOM.nextDouble(level.getHeight()));
position = new Point2D(level.getWidth() * Config.getInstance().getMonsterMinXPopsition()
+ RANDOM.nextDouble(level.getWidth() - image.getWidth()), RANDOM.nextDouble(level.getHeight()));
speed = new Point2D(0, RANDOM.nextDouble(Config.getInstance().getMonsterMinSpeed(),
Config.getInstance().getMonsterMaxSpeed()));
}
......@@ -55,7 +53,7 @@ public class Monster extends WorldEntity implements Collisionable {
if (position.getY() + image.getHeight() < 0) {
position = new Point2D(position.getX(), level.getHeight());
}
log.trace("Monster position: {}", position); }
}
@Override
public Rectangle2D getBoundingBox() {
......
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