From 06ac444ba2813c73d0fb3db607fdbf7038969d09 Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Fri, 23 Mar 2018 12:46:27 +0100 Subject: [PATCH 1/3] schrijffouten verbeteren --- OGP1718-Worms/src/worms/model/Worm.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OGP1718-Worms/src/worms/model/Worm.java b/OGP1718-Worms/src/worms/model/Worm.java index 63f8b2b..bd1de04 100644 --- a/OGP1718-Worms/src/worms/model/Worm.java +++ b/OGP1718-Worms/src/worms/model/Worm.java @@ -552,15 +552,15 @@ public class Worm { * @param numberSteps * the number of steps the worm should take * - * @post the x-coordinate of the new location of the worm schould be the location of + * @post the x-coordinate of the new location of the worm should be the location of * the old x-coordinate plus the number of steps multiplied with the distance - * that the x-coordinate schould move (distance is equal to the radius multiplied + * that the x-coordinate should move (distance is equal to the radius multiplied * with the cosinus of the orientation) * |distanceX = this.radius * cos(getOrientation()) * |new.xCoordinate = getLocation().item1 + numberSteps * distanceX - * @post the y-coordinate of the new location of the worm schould be the location of + * @post the y-coordinate of the new location of the worm should be the location of * the old y-coordinate plus the number of steps multiplied with the distance - * that the y-coordinate schould move (distance is equal to the radius multiplied + * that the y-coordinate should move (distance is equal to the radius multiplied * with the sinus of the orientation) * |distanceY = this.radius * sin(getOrientation()) * |new.yCoordinate = getLocation().item2 + numberSteps * distanceY @@ -658,7 +658,7 @@ public class Worm { * @post the worm jumps to his new place. The new place is the x-coordinate plus the jump distance * with the jump velocity * |setLocation(Tuple.create(getLocation().item1 + jumpDistance(this.jumpVelocity()), getLocation().item2)) - * @post the current action actionPoints schould be 0 after a jump + * @post the current action actionPoints should be 0 after a jump * |setActionPoints(0) * @throws IllegalStateException * if the current action actionPoints is equal to 0 or the orientation is more then @@ -695,7 +695,7 @@ public class Worm { /** * * @param deltaTime - * the total time the worm schould jump + * the total time the worm should jump * @return Tuple with the new location of the worm. The new x-coordinate is the old x-coordinate plus the jump velocity * multiplied with the cosinus of the orientation multiplied with delta time. The new y-coordinate is the old y-coordinate plus * the jump velocity multiplied with the sinus of the orientation multiplied with delta time minus 0,5 times the gravity multiplied From 311ecfd9ce30eacd36c7e0b787cbf6ce8ad833fc Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Fri, 23 Mar 2018 13:01:03 +0100 Subject: [PATCH 2/3] nieuwe classes --- OGP1718-Worms/src/worms/model/Food.java | 5 +++++ OGP1718-Worms/src/worms/model/Team.java | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 OGP1718-Worms/src/worms/model/Food.java create mode 100644 OGP1718-Worms/src/worms/model/Team.java diff --git a/OGP1718-Worms/src/worms/model/Food.java b/OGP1718-Worms/src/worms/model/Food.java new file mode 100644 index 0000000..2129851 --- /dev/null +++ b/OGP1718-Worms/src/worms/model/Food.java @@ -0,0 +1,5 @@ +package worms.model; + +public class Food { + +} diff --git a/OGP1718-Worms/src/worms/model/Team.java b/OGP1718-Worms/src/worms/model/Team.java new file mode 100644 index 0000000..8e15048 --- /dev/null +++ b/OGP1718-Worms/src/worms/model/Team.java @@ -0,0 +1,5 @@ +package worms.model; + +public class Team { + +} From b61378e423c5534d33755f55d5a2019a0546ac01 Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Fri, 23 Mar 2018 13:19:20 +0100 Subject: [PATCH 3/3] methodes ivm hit points --- OGP1718-Worms/src/worms/model/Worm.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/OGP1718-Worms/src/worms/model/Worm.java b/OGP1718-Worms/src/worms/model/Worm.java index bd1de04..a50109a 100644 --- a/OGP1718-Worms/src/worms/model/Worm.java +++ b/OGP1718-Worms/src/worms/model/Worm.java @@ -6,6 +6,8 @@ import worms.util.IllegalNameException; import static java.lang.Math.*; +import java.util.Random; + /** * A class with the specifications of the worm * @@ -122,6 +124,9 @@ public class Worm { if (validName != -1) throw new IllegalNameException(validName, name); this.name = name; + + long startHitPoints = 1000 + (new Random().nextLong() * (2000 - 1000)); + setHitPoints(startHitPoints); } //=================================================================================== @@ -754,6 +759,26 @@ public class Worm { } + //=================================================================================== + // endregion + + // region hitPoints + //=================================================================================== + + @Basic @Raw + public long gethitPoints() { + return this.hitPoints; + } + + @Raw + private void setHitPoints(long hitPoints) { + if (hitPoints <= 0) + //TODO worm sterft + weghalen van gamewereld + this.hitPoints = hitPoints; + } + + private long hitPoints; + //=================================================================================== // endregion }