Documentatie move methodes
This commit is contained in:
@@ -551,8 +551,15 @@ public class Worm extends GameObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the direction in which the furthest location is maximal.
|
||||
*
|
||||
* @return
|
||||
* @return The direction in which the furthest location is maximal. Where the distance between
|
||||
* the center and a point on the circle (shape of worm) maximal is. The furthes location
|
||||
* has to be passable.
|
||||
* |for each direction:
|
||||
* | if new.getDistance > maxDistance:
|
||||
* | maxDistance == new.getDistance
|
||||
* |result == maxDistance
|
||||
*/
|
||||
public double getFurthestLocationDirection() {
|
||||
Coordinate location = getLocation();
|
||||
@@ -574,11 +581,35 @@ public class Worm extends GameObject {
|
||||
return maxLocDirection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the distance between two coordinates.
|
||||
*
|
||||
* @param start
|
||||
* The start coordinate of the equation.
|
||||
* @param end
|
||||
* The end coordinate of the equation.
|
||||
*
|
||||
* @return the distance between the two given coordinates. The distance is equal to
|
||||
* the square root of the square of the displacement of the x coordinate plus the
|
||||
* square of the displacement of the y coordinate.
|
||||
* |result == sqrt(pow(start.getX()-end.getX())+pow(start.getY()-end.getY()))
|
||||
*/
|
||||
public double getDistance(Coordinate start, Coordinate end) {
|
||||
return Math.sqrt(Math.pow(Math.abs(start.getX() - end.getX()), 2) +
|
||||
Math.pow(Math.abs(start.getY() - end.getY()), 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* The clashing worms their hit points are reduced.
|
||||
*
|
||||
* @param basicWorm
|
||||
* The worm who has moved.
|
||||
* @param worm
|
||||
* The worms who has clashed with the basicworm.
|
||||
*
|
||||
* @post All the worms that clashed their hitpoints are reduced. There is a random integer between
|
||||
* 1 and 10 (= N). The lose of the smalles worm is equal to N divided by the orientation o
|
||||
*/
|
||||
public void collision(Worm basicWorm, Worm... worm) {
|
||||
Worm largestWorm;
|
||||
Worm smallestWorm;
|
||||
|
Reference in New Issue
Block a user