From 87946a1c201c04de5a41c5784cfe2b4e2ce1046f Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Sun, 11 Mar 2018 16:36:17 +0100 Subject: [PATCH] commentaar jumpStep --- OGP1718-Worms/src/worms/model/Worm.java | 13 +++++++++++-- docs/TODO.txt | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/OGP1718-Worms/src/worms/model/Worm.java b/OGP1718-Worms/src/worms/model/Worm.java index 37fd9ef..3eb13e4 100644 --- a/OGP1718-Worms/src/worms/model/Worm.java +++ b/OGP1718-Worms/src/worms/model/Worm.java @@ -662,8 +662,17 @@ public class Worm { /** * - * @param deltaTime ... - * @return Tuple + * @param deltaTime + * the total time the worm schould 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 + * with the second power of delta time + * |Tuple.create(getLocation().item1 + this.jumpVelocity() * cos(getOrientation()) * deltaTime, + |getLocation().item2 + this.jumpVelocity() * sin(getOrientation()) * deltaTime - 0.5 * G * pow(deltaTime, 2)) + * @throws IllegalArgumentException() + * if the deltaTime is not a number or bigger then jumpTime or smaller then 0 + * |if (Double.isNaN(deltaTime) || deltaTime > this.jumpTime() || deltaTime < 0) */ public Tuple jumpStep(double deltaTime) { if (Double.isNaN(deltaTime) || deltaTime > this.jumpTime() || deltaTime < 0) diff --git a/docs/TODO.txt b/docs/TODO.txt index f6981d4..ea08486 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -4,7 +4,7 @@ - getMaxActionPoints DONE - decreaseActionPoints DONE - canTurn DONE - - Tuple (methode) + - jumpStep DONE * testen schrijven * documentatie Facade * is Facade klaar?