From 2d42de83de4adf589d485e923bb30c9da2222ae6 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 26 Sep 2018 13:22:30 -0400 Subject: [PATCH] Slightly less wall hugging --- .../src/io/anuke/mindustry/entities/units/GroundUnit.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/io/anuke/mindustry/entities/units/GroundUnit.java b/core/src/io/anuke/mindustry/entities/units/GroundUnit.java index 408b4b1e45..ac26f1197d 100644 --- a/core/src/io/anuke/mindustry/entities/units/GroundUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/GroundUnit.java @@ -80,7 +80,13 @@ public abstract class GroundUnit extends BaseUnit{ public void update(){ target = getClosestCore(); if(target != null){ - circle(60f + Mathf.absin(Timers.time() + id*23525, 70f, 1200f)); + vec.trns(baseRotation, type.speed); + velocity.add(vec.x, vec.y); + vec.trns(baseRotation, type.hitsizeTile); + Tile tile = world.tileWorld(x + vec.x, y + vec.y); + if((tile == null || tile.solid()) || distanceTo(target) > 400f + Mathf.randomSeed(id)*350f){ + baseRotation += Mathf.sign(id % 2 - 0.5f) * Timers.delta() * 3f; + } } } },