This commit is contained in:
Mini-Chiss 2015-08-29 16:46:55 -07:00
parent 05ecfb8ff0
commit 6bd29394b3

View File

@ -40,6 +40,8 @@ public class SnakeCreature extends EventCreature<Silverfish>
private boolean _enabled = true; private boolean _enabled = true;
private int _ticks = 0;
public SnakeCreature(WorldEvent event, Location spawnLocation) public SnakeCreature(WorldEvent event, Location spawnLocation)
{ {
super(event, spawnLocation, "Serpent Lord", false, 2000, Silverfish.class); super(event, spawnLocation, "Serpent Lord", false, 2000, Silverfish.class);
@ -163,7 +165,17 @@ public class SnakeCreature extends EventCreature<Silverfish>
{ {
Vector moveTo = UtilAlg.getTrajectory(vec, _waypoint.toVector()); Vector moveTo = UtilAlg.getTrajectory(vec, _waypoint.toVector());
_velocity.add(moveTo.multiply(0.04)); Vector target = vec.clone().add(moveTo.multiply(1));
//MATHS
double speed = 10d;
double right = -Math.sin(_ticks/speed) * 4;
double up = Math.cos(_ticks/speed) * 4;
target.add(UtilAlg.getRight(vec).multiply(right));
target.add(UtilAlg.getUp(vec).multiply(up));
_velocity.add(target.normalize().multiply(0.04));
if (_velocity.length() > 0.5) if (_velocity.length() > 0.5)
_velocity.normalize().multiply(0.5); _velocity.normalize().multiply(0.5);