From 6bd29394b34eaa6b955d3139a3f27dfabf031d51 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Sat, 29 Aug 2015 16:46:55 -0700 Subject: [PATCH] snake --- .../game/core/boss/snake/SnakeCreature.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeCreature.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeCreature.java index 02e9f0803..12618ccfd 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeCreature.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/boss/snake/SnakeCreature.java @@ -39,6 +39,8 @@ public class SnakeCreature extends EventCreature private Vector _velocity = new Vector(0,0,0); private boolean _enabled = true; + + private int _ticks = 0; public SnakeCreature(WorldEvent event, Location spawnLocation) { @@ -163,7 +165,17 @@ public class SnakeCreature extends EventCreature { 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) _velocity.normalize().multiply(0.5);