Fall methode (nog niet klaar)
This commit is contained in:
@@ -818,9 +818,37 @@ public class Worm extends GameObject {
|
|||||||
// region falling
|
// region falling
|
||||||
//===================================================================================
|
//===================================================================================
|
||||||
|
|
||||||
public void fall() {
|
private void fall() {
|
||||||
|
double[] center = {getLocation().getCoordinateX(), getLocation().getCoordinateY()};
|
||||||
|
Coordinate oldLocation = getLocation();
|
||||||
|
double endY = getLocation().getCoordinateY();
|
||||||
|
if (! getWorld().isAdjacent(center, minRadius)) {
|
||||||
|
for (double y = oldLocation.getCoordinateY(); y < 0; y--) {
|
||||||
|
if (y < 0) {
|
||||||
|
terminate();
|
||||||
|
}
|
||||||
|
if (getWorld().isAdjacent(center, minRadius)) {
|
||||||
|
double[] newLoc = {oldLocation.getCoordinateX(), y};
|
||||||
|
setLocation(newLoc);
|
||||||
|
endY = y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
center[1] = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO hitpoints en eventuele botsing
|
||||||
|
double distanceY = getWorld().getHeight();
|
||||||
|
|
||||||
|
long cost = 3 * (long) (oldLocation.getCoordinateY() - endY);
|
||||||
|
incrementHitPoints(cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void collisionFall(Worm fallingWorm, Worm... worm) {
|
||||||
|
for (Worm stationaryWorm: worm) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//===================================================================================
|
//===================================================================================
|
||||||
// endregion
|
// endregion
|
||||||
|
Reference in New Issue
Block a user